OFFSET
1,4
COMMENTS
LINKS
Robert Israel, Table of n, a(n) for n = 1..168
FORMULA
a(n*10^k) = 0 for all k > 0 since definition does not allow leading 0's.
EXAMPLE
a(4) is 2, because 4^2 is 16, and 16 reversed is 61 which is prime.
MAPLE
Rev:= proc(n) local L;
L:= convert(n, base, 10);
add(L[-i]*10^(i-1), i=1..nops(L))
end proc:
f:= proc(n) local k;
if igcd(n, 33) <> 1 or (n/10)::integer then return 0 fi;
for k from 1 do if isprime(Rev(n^k)) then return k fi od:
end proc:
f(1):= 0: f(3):= 1: f(11):= 1:
map(f, [$1..168]); # Robert Israel, Apr 08 2018
MATHEMATICA
Do[ If[ Mod[ n, 3 ] != 0 && Mod[ n, 10 ] != 0 && Mod[ n, 11 ] != 0, k = 1; While[ !PrimeQ[ ToExpression[ StringReverse[ ToString[ n^k ] ] ] ], k++ ]; Print[ k ], Print[ 0 ] ], {n, 2, 75} ]
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Robert G. Wilson v, Jan 17 2001
STATUS
approved