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
François Marques, Table of n, a(n) for n = 1..10000
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))<b-1, b--); b;
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
François Marques, Oct 21 2020
STATUS
approved