OFFSET
1,2
COMMENTS
There are infinitely many zeros since if n is a multiple of 2520, then each base-b expansion ends with digit 0.
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
FORMULA
a(2520*n) = 0.
a(630*n) = 0. - Robert Israel, Sep 09 2025
EXAMPLE
a(10) = 3 since 10 in base 3 is "101" and 101 is prime; base 2 is "1010" -> 1010 composite.
a(11) = 4 since base 4 gives "23" -> 23 is prime; base 2 "1011" -> 1011 composite; base 3 "102" -> 102 composite.
a(23) = 2 since base 2 gives "10111" -> 10111 is prime.
MAPLE
f:= proc(n) local b, L, i;
for b from 2 to 10 do
L:= convert(n, base, b);
if isprime(add(L[i]*10^(i-1), i=1..nops(L))) then return b fi
od;
0
end proc:
map(f, [$1..100]); # Robert Israel, Sep 09 2025
MATHEMATICA
a[n_] := Block[{m}, Do[m = FromDigits[IntegerDigits[n, b], 10]; If[PrimeQ[m], Return[b]], {b, 2, 10}]; 0]
PROG
(PARI) a(n) = for(b=2, 10, if (isprime(fromdigits(digits(n, b))), return(b))); \\ Michel Marcus, Aug 09 2025
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Pietro Tiaraju Giavarina dos Santos, Aug 08 2025
STATUS
approved
