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.

A074831 Number of binary reversal primes less than 10^n.

Original entry on oeis.org

3, 20, 101, 508, 3053, 20053, 141772, 1045600, 8038954, 63830588, 518935134, 4311185894
Offset: 1

Views

Author

Robert G. Wilson v, Sep 09 2002

Keywords

Comments

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

Programs

  • Mathematica
    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}]
  • Python
    from sympy import isprime, primerange
    def is_bin_rev_prime(n): return isprime(int(bin(n)[2:][::-1], 2))
    def a(n): return sum(is_bin_rev_prime(p) for p in primerange(1, 10**n))
    print([a(n) for n in range(1, 7)]) # Michael S. Branicky, Mar 20 2021

Extensions

a(10)-a(11) from Chai Wah Wu, Oct 09 2018
a(12) from Chai Wah Wu, Oct 10 2018