login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A337164
a(n) is the least base, other than 10, in which the decimal digits of n represent a prime, or 0 if there is no such base.
1
3, 4, 0, 6, 0, 8, 0, 0, 0, 2, 3, 4, 7, 6, 7, 12, 9, 14, 0, 3, 0, 4, 0, 6, 0, 8, 0, 11, 0, 4, 5, 0, 5, 6, 0, 8, 11, 0, 0, 7, 0, 5, 0, 6, 0, 9, 0, 11, 0, 6, 7, 8, 11, 0, 7, 8, 9, 14, 0, 7, 0, 0, 0, 7, 0, 9, 0, 0, 0, 16, 11, 8, 9, 8, 11, 0, 9, 14, 0, 9, 0, 13, 0, 12, 0, 9, 0, 11, 0, 12, 11, 0, 11
OFFSET
2,1
LINKS
EXAMPLE
a(12) = 3 because 12_3 = 5 is prime.
MAPLE
f:= proc(n) local L, b, i, x, v, p;
L:= convert(n, base, 10);
if L[1] = 0 or igcd(op(L)) > 1 or not irreduc(add(L[i]*x^(i-1), i=1..nops(L))) then return 0 fi;
b:= max(L)+1;
if b = 10 then b:= 11 fi;
v:= add(L[i]*b^(i-1), i=1..nops(L));
if isprime(v) then return b fi;
for p in numtheory:-factorset(v) do
if andmap(t -> add(L[i]*t^(i-1), i=1..nops(L)) mod p = 0, [$0..p-1]) then return 0 fi;
od;
for b from b+1 to 10^4 do
if b = 10 then next fi;
if isprime(add(L[i]*b^(i-1), i=1..nops(L))) then return b fi
od;
FAIL
end proc:
f(2):= 3: f(3):= 4: f(5):= 6: f(7):= 8:
map(f, [$2..200]);
CROSSREFS
Sequence in context: A086230 A197485 A158677 * A105576 A105826 A110665
KEYWORD
nonn,base
AUTHOR
J. M. Bergot and Robert Israel, Jan 28 2021
STATUS
approved