OFFSET
2,1
COMMENTS
The base-b representation of n must not use any digits > 9.
For n >= 19, a(n) <= n-9 since the base-(n-9) representation of n is 19.
If n >= 29 is odd, a(n) <= (n-9)/2 since the base-((n-9)/2) representation of n is 29.
LINKS
Robert Israel, Table of n, a(n) for n = 2..10000
EXAMPLE
a(7) = 4 because 7 = 13_4, 13 is prime, and no smaller number than 4 works.
a(14) = 11 because 14 = 13_11,
MAPLE
f:= proc(n) local b, L, i, p;
for b from 2 do
L:= convert(n, base, b);
if max(L) > 9 then next fi;
p:= add(L[i]*10^(i-1), i=1..nops(L));
if isprime(p) then return b fi
od
end proc:
map(f, [$2..100]);
MATHEMATICA
a[n_]:=Module[{b=2}, While[!ContainsOnly[IntegerDigits[n, b], Range[0, 9]]||!PrimeQ[FromDigits[IntegerDigits[n, b]]], b++]; b]; Array[a, 91, 2] (* James C. McMahon, Sep 22 2025 *)
PROG
(PARI) isok(n, b) = my(d=digits(n, b)); (vecmax(d) <=9) && isprime(fromdigits(d));
a(n) = my(b=2); while(!isok(n, b), b++); b; \\ Michel Marcus, Sep 16 2025
CROSSREFS
KEYWORD
AUTHOR
Robert Israel, Sep 16 2025
STATUS
approved
