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.

A177858 Triangle in which row n gives the number of primes <= 2^n having k 1's in their binary representation, k=1..n.

Original entry on oeis.org

1, 1, 1, 1, 2, 1, 1, 2, 3, 0, 1, 3, 4, 2, 1, 1, 3, 6, 4, 4, 0, 1, 3, 9, 9, 8, 0, 1, 1, 3, 12, 13, 20, 0, 5, 0, 1, 4, 12, 23, 31, 8, 14, 4, 0, 1, 4, 16, 29, 48, 24, 38, 9, 3, 0, 1, 4, 18, 42, 73, 52, 72, 29, 17, 1, 0, 1, 4, 21, 53, 111, 80, 151, 81, 52, 5, 5, 0, 1, 4, 23, 62, 152, 158, 256, 186
Offset: 1

Views

Author

T. D. Noe, May 14 2010

Keywords

Comments

Every row begins with 1 because 2 is the only prime having one 1 in its binary representation. A row ends in 1 or 0, depending on whether 2^n-1 is prime or composite. The sum of terms in row n is A007053(n).

Crossrefs

Cf. A061712 (least prime having n 1's)

Programs

  • Mathematica
    nn=20; cnt=Table[0,{nn}]; Flatten[Table[Do[p=Prime[i]; c=Total[IntegerDigits[p,2]]; cnt[[c]]++, {i, 1+PrimePi[2^(n-1)], PrimePi[2^n]}]; Take[cnt,n], {n,nn}]]