[go: up one dir, main page]

login
For n > 1, a(n) is the largest base b <= n such that the digits of n in base b contain the digit b-1; a(1) = 1.
3

%I #35 Dec 16 2020 17:42:14

%S 1,2,2,2,3,3,4,3,5,2,6,4,7,5,8,3,9,3,10,7,11,5,12,5,13,9,14,4,15,6,16,

%T 11,17,7,18,2,19,13,20,2,21,7,22,15,23,7,24,7,25,17,26,4,27,11,28,19,

%U 29,8,30,8,31,21,32,13,33,6,34,23,35,6

%N For n > 1, a(n) is the largest base b <= n such that the digits of n in base b contain the digit b-1; a(1) = 1.

%C The choice b <= n in the name of this sequence comes from the fact that base n+1 has the desired property for all n > 1.

%C For n > 2, a(n) <= (n+1)/2.

%H François Marques, <a href="/A338295/b338295.txt">Table of n, a(n) for n = 1..10000</a>

%F a(n) = (n + 1)/lpf(n + 1) if n + 1 is composite, where lpf(n) is the least prime dividing n, A020639. - _Devansh Singh_, Dec 06 2020

%e a(7) = 4, since 7 = 13_4 so containing the digit 3, and 7 = 12_5 = 11_6 = 10_7.

%e a(10) = 2, since 10 = 1010_2 so containing the digit 1, and this does not happen for bases between 3 and 10 (i.e., 10 is in the sequence A337536).

%t baseQ[n_, b_] := MemberQ[IntegerDigits[n, b], b - 1]; a[1] = 1; a[n_] := Select[Range[n, 2, -1], baseQ[n, #] &, 1][[1]]; Array[a, 100] (* _Amiram Eldar_, Oct 21 2020 *)

%o (PARI) a(n) = if (n==1, return (1)); my(b=ceil((n+1)/2)); while(vecmax(digits(n, b))<b-1, b--); b;

%Y Cf. A337496, A337535, A020639.

%K nonn,base,easy

%O 1,2

%A _François Marques_, Oct 21 2020