login
Number of binary reversal primes less than 10^n.
1

%I #21 Sep 29 2023 12:00:39

%S 3,20,101,508,3053,20053,141772,1045600,8038954,63830588,518935134,

%T 4311185894

%N Number of binary reversal primes less than 10^n.

%C MathPages counts 1 as being a binary reversal prime whereas the title would exclude it, therefore their count exceeds this count by one.

%H Kevin S. Brown's Mathpages, <a href="http://www.mathpages.com/home/kmath362.htm">Reflective and Cyclic Sets of Primes</a>

%H Cécile Dartyge, Bruno Martin, Joël Rivat, Igor E. Shparlinski, and Cathy Swaenepoel, <a href="https://arxiv.org/abs/2309.11380">Reversible primes</a>, arXiv:2309.11380 [math.NT], 2023. See p. 34.

%t f[n_] := FromDigits[Reverse[IntegerDigits[n, 2]], 2]; NextPrim[n_] := Block[{k = n + 1}, While[ ! PrimeQ[k], k++ ]; k]; c = 0; k = 1; Do[ While[k = NextPrim[k]; k < 10^n, If[ PrimeQ[ f[k]], c++ ]]; k--; Print[c], {n, 16}]

%o (Python)

%o from sympy import isprime, primerange

%o def is_bin_rev_prime(n): return isprime(int(bin(n)[2:][::-1], 2))

%o def a(n): return sum(is_bin_rev_prime(p) for p in primerange(1, 10**n))

%o print([a(n) for n in range(1, 7)]) # _Michael S. Branicky_, Mar 20 2021

%K nonn,base,hard,more

%O 1,1

%A _Robert G. Wilson v_, Sep 09 2002

%E a(10)-a(11) from _Chai Wah Wu_, Oct 09 2018

%E a(12) from _Chai Wah Wu_, Oct 10 2018