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).

This page as a plain text file.
%I A361312 #25 Mar 24 2023 17:49:32
%S A361312 2,3,5,3893257,9632552297
%N 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).
%C A361312 Prime numbers that remain primes after 1, 2, 3, and 4 iterations are A065720, A123266, A256621 and A256622, respectively.
%H A361312 Carlos Rivera, <a href="http://www.primepuzzles.net/puzzles/puzz_280.htm">Puzzle 280. 3893257</a>, The Prime Puzzles & Problems Connection.
%e A361312 a(0) = 2 because prime number 2 in base 2 is 10, and 10 in base 10 is not a prime.
%e A361312 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.
%e A361312 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.
%o A361312 (Python)
%o A361312 from sympy import isprime, nextprime
%o A361312 p = 1; mx = 5; I = [*range(mx)]; R = [*range(mx)]
%o A361312 while I:
%o A361312     p = nextprime(p); ct = 0; q = p
%o A361312     while isprime(int(bin(q)[2:])): ct += 1; q = int(bin(q)[2:])
%o A361312     if ct in I: R[ct] = p; I.remove(ct)
%o A361312 print(*R, sep = ", ")
%Y A361312 Cf. A007088, A036952, A065720, A123266, A256621, A256622.
%K A361312 nonn,base,more
%O A361312 0,1
%A A361312 _Ya-Ping Lu_, Mar 08 2023