|
|
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).
|
|
0
|
|
|
|
OFFSET
|
0,1
|
|
COMMENTS
|
|
|
LINKS
|
|
|
EXAMPLE
|
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.
|
|
PROG
|
(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 = ", ")
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base,more
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|