cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A058998 Least exponent k for which n^k reversed (leading zeros are not allowed) is a prime, or 0 if impossible.

Original entry on oeis.org

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

Views

Author

Robert G. Wilson v, Jan 17 2001

Keywords

Comments

There are two different versions of this sequence: A085324 and this sequence which agrees with A085324 on the first 19 terms, but differs at a(20).

Examples

			a(4) is 2, because 4^2 is 16, and 16 reversed is 61 which is prime.
		

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.