

A338295


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


3



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, 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, 29, 8, 30, 8, 31, 21, 32, 13, 33, 6, 34, 23, 35, 6
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,2


COMMENTS

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.
For n > 2, a(n) <= (n+1)/2.


LINKS



FORMULA

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


EXAMPLE

a(7) = 4, since 7 = 13_4 so containing the digit 3, and 7 = 12_5 = 11_6 = 10_7.
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).


MATHEMATICA

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 *)


PROG

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


CROSSREFS



KEYWORD

nonn,base,easy


AUTHOR



STATUS

approved



