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.

A059004 Smallest prime whose reversal is an n-th power.

Original entry on oeis.org

2, 61, 521, 61, 23, 61277761, 821, 61277761, 23888027348153, 4201, 33670369817243, 61277761, 5265674839116110941, 441435249928911950281, 23888027348153, 1232787935486158110509626783, 270131
Offset: 1

Views

Author

Robert G. Wilson v, Jan 16 2001

Keywords

Crossrefs

Cf. A007488.

Programs

  • Maple
    revdigs:= proc(n) local L,k;
      L:= convert(n,base,10);
      add(L[-k]*10^(k-1),k=1..nops(L))
    end proc:
    f:= proc(n) local d, k, wmin,  v,w;
      wmin:= infinity;
      for d from 1 do
        for k from ceil(10^(d/n)) do
          v:= k^n;
          if v >= 10^(d+1) then break fi;
          w:= revdigs(v);
          if isprime(w) and w < wmin then wmin:= w fi;
        od;
        if wmin < infinity then return wmin fi
      od
    end proc:
    map(f, [$1..20]); # Robert Israel, May 22 2019
  • Mathematica
    Do[ k = 1; While[ r = ToExpression[ StringReverse[ ToString[ k^n ] ] ]; ! PrimeQ[ r ], k++ ]; Print[ r ], {n, 1, 25} ]