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.

A255073 Primes that remain prime after each digit is replaced by the power of its position.

Original entry on oeis.org

2, 3, 5, 7, 11, 13, 17, 19, 23, 37, 43, 47, 67, 71, 79, 83, 101, 103, 107, 109, 113, 131, 137, 139, 167, 173, 179, 191, 211, 241, 263, 269, 281, 307, 311, 313, 331, 337, 353, 359, 367, 397, 431, 479, 491, 503, 521, 577, 593, 601, 613, 617, 659, 673
Offset: 1

Views

Author

Abhiram R Devesh, Feb 14 2015

Keywords

Comments

In the definition, "position" refers to the position of the digit in the decimal expansion, starting counting at 1 for the least significant digit.
In the Example section, the notation a&b denotes the concatenation of two numbers, a and b.
a(n) = n for 2, 3, 5, 7, 11, 13, 17, 19, 101, 103, 107, 109, 113, ...

Examples

			p =   2 -> (2^1)             -> 2 (prime).
p =  23 -> (2^2)&(3^1)       -> 43 (prime).
p = 337 -> (3^3)&(3^2)&(7^1) -> 2797 (prime).
		

Programs

  • Mathematica
    f[n_] := Block[{d = Reverse@ IntegerDigits@ n, k}, FromDigits[Reap@ For[k = 1, k <= Length@ d, k++, Sow[d[[k]]^k]] // Flatten // Rest // Reverse // IntegerDigits // Flatten]]; Select[Prime@ Range@ 125, PrimeQ[f@ #] &] (* Michael De Vlieger, Apr 02 2015 *)
  • Python
    import sympy
    def powdig(m):
        l=len(str(m))
        return(int(''.join([str(int(list(i)[1])**(l-list(i)[0])) for i in enumerate(list(str(m)))])))
    n=2
    while n>0:
        t=powdig(n)
        if sympy.isprime(t)==True:
            print(n)
        n=sympy.nextprime(n)