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.

A361312 Smallest prime p such that the decimal expansion of p remains prime through exactly n iterations of base-10 to base-2 conversion (A007088).

Original entry on oeis.org

2, 3, 5, 3893257, 9632552297
Offset: 0

Views

Author

Ya-Ping Lu, Mar 08 2023

Keywords

Comments

Prime numbers that remain primes after 1, 2, 3, and 4 iterations are A065720, A123266, A256621 and A256622, respectively.

Examples

			a(0) = 2 because prime number 2 in base 2 is 10, and 10 in base 10 is not a prime.
a(1) = 3 because 3 = 11_2 and 11_10 is a prime. In the second iteration, however, 11_10 = 1011_2 and 1011_10 is not a prime.
a(2) = 5 because 5 = 101_2 and 101_10 = 1100101_2. Both 101 and 1100101 are primes in base 10. In the third iteration, 1100101_10 = 100001100100101000101_2 and 100001100100101000101_10 is not a prime.
		

Crossrefs

Programs

  • Python
    from sympy import isprime, nextprime
    p = 1; mx = 5; I = [*range(mx)]; R = [*range(mx)]
    while I:
        p = nextprime(p); ct = 0; q = p
        while isprime(int(bin(q)[2:])): ct += 1; q = int(bin(q)[2:])
        if ct in I: R[ct] = p; I.remove(ct)
    print(*R, sep = ", ")