A058998 Least exponent k for which n^k reversed (leading zeros are not allowed) is a prime, or 0 if impossible.
0, 1, 1, 2, 1, 0, 1, 8, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 2, 0, 0, 0, 8, 0, 13, 47, 0, 2, 7, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 2, 0, 5, 0, 0, 22, 15, 0, 6, 0, 0, 3, 10, 0, 0, 143, 0, 88, 12, 0, 4, 2, 0, 4, 8, 0, 39, 83, 0, 0, 1, 0, 1, 1, 0
Offset: 1
Examples
a(4) is 2, because 4^2 is 16, and 16 reversed is 61 which is prime.
Links
- Robert Israel, Table of n, a(n) for n = 1..168
Crossrefs
Cf. A085324.
Programs
-
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} ]
Formula
a(n*10^k) = 0 for all k > 0 since definition does not allow leading 0's.
Comments