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.

Showing 1-2 of 2 results.

A086904 Write the primes in binary; a(n) = total number of 0's in those which have an n-bit expansion.

Original entry on oeis.org

1, 1, 2, 7, 13, 35, 71, 147, 298, 622, 1270, 2558, 5257, 10509, 21297, 42852, 86258, 173528, 348187, 699590, 1404936, 2818606, 5657411, 11345622, 22746823, 45605127, 91421299, 183206338, 367111951, 735525895, 1473503602, 2951661316, 5911864292, 11840082252
Offset: 2

Views

Author

Jacob Woolcutt (woolcutt(AT)uiuc.edu), Sep 19 2003

Keywords

Examples

			a(2) = 1: 2 = 10 and 3 = 11, with a total of one 0.
a(3) = 1: 5 = 101, 7 = 111, again with just one 0.
		

Crossrefs

Cf. A168156.

Programs

  • Mathematica
    a[n_] := Sum[If[PrimeQ[k], DigitCount[k, 2, 0], 0], {k, 2^(n - 1), 2^n - 1}]; Array[a, 20, 2] (* Amiram Eldar, Jan 11 2020 *)
  • PARI
    a(n) = {nb = 0; for (i=2^(n-1), 2^n-1, if (isprime(i), nb += n - norml2(binary(i)));); return (nb);} \\ Michel Marcus, Jun 20 2013

Extensions

a(27)-a(35) from Amiram Eldar, Jan 11 2020

A168155 Sum of binary digits of all primes < 2^n, i.e., with at most n binary digits.

Original entry on oeis.org

0, 3, 8, 14, 32, 61, 117, 230, 470, 922, 1807, 3597, 7071, 14022, 27693, 54876, 109077, 216301, 430183, 854696, 1700412, 3382868, 6733230, 13404811, 26704639, 53204936, 106034897, 211377718, 421466683, 840573072, 1676670824, 3345012214, 6674425203, 13319553281
Offset: 1

Views

Author

M. F. Hasler, Nov 20 2009

Keywords

Comments

Partial sums of A168156.

Examples

			No prime can be written with only 1 binary digit, thus a(1)=0.
The primes that can be written with 2 binary digits are 2 = 10[2] and 3 = 11[2], they have 3 nonzero bits, so a(2)=3.
Primes with 3 binary digits are 5 = 101[2] and 7 = 111[3]. They add 5 more nonzero bits to yield a(3) = a(2)+5 = 8.
		

Crossrefs

Cf. A168153.

Programs

  • PARI
    s=0; L=p=2; while( L*=2, print1(s", "); until( L
    				

Formula

a(n) = A095375( pi( 2^n-1 )), where pi = A000720.

Extensions

a(25)-a(32) from Donovan Johnson, Jul 28 2010
a(33) from Chai Wah Wu, Apr 06 2020
a(34) from Chai Wah Wu, Apr 07 2020
Showing 1-2 of 2 results.