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.

A292163 a(n) is the least prime p such that the orderly concatenation of the n successive powers of p yields a prime number; a(n)=0 if n is a multiple of 6.

Original entry on oeis.org

3, 3, 337, 23, 0, 373, 37, 839, 421, 7, 0, 1447, 2113, 29, 43, 17, 0, 1789, 523, 84737, 7669, 397, 0, 3851, 3583, 99149, 146023, 157, 0, 14173, 38329, 1229, 8017, 1021, 0, 18979, 5437, 17207, 6571, 47, 0, 347, 43669, 25847, 257353, 2887, 0, 33889, 71287
Offset: 2

Views

Author

Michel Marcus, Sep 10 2017

Keywords

Comments

See in the Prime Puzzle link the discussion for when n is a multiple of 6.

Examples

			For n=2, the concatenation of 3^0 and 3^1 is 13 which is prime (while 12 was not prime); so a(2) = 3.
For n=3, the concatenation of 3^0, 3^1 and 3^2 is 139 which is prime (while 124 was not prime); so a(3) = 3.
		

Crossrefs

Cf. A047253.

Programs

  • Maple
    g:= proc(p,n) local i,t;
      t:= p^(n-1):
      for i from n-2 to 0 by -1 do
        t:= t + 10^(1+ilog10(t))*p^i
      od;
      t
    end proc:
    f:= proc(n)
      local p;
      if n mod 6 = 0 then return 0 fi;
      p:= 3;
      while not isprime(g(p,n)) do
        p:= nextprime(p);
        if n mod 3 = 0 then while p mod 3 = 1 do p:= nextprime(p) od fi:
      od;
      p
    end proc:
    map(f, [$2..30]); # Robert Israel, Sep 10 2017
  • PARI
    pconc(p, n) = {my(s = "1"); for (k=1, n, s = concat(s, Str(p^k));); eval(s);}
    a(n) = {if (!(n % 6), return (0)); n --; my(p = 2); while (! isprime(pconc(p, n)), p = nextprime(p+1)); p;}

Extensions

a(27)-a(50) from Robert Israel, Sep 10 2017