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.

A328659 Partial sums of A035100: number of binary digits of the primes.

Original entry on oeis.org

0, 2, 4, 7, 10, 14, 18, 23, 28, 33, 38, 43, 49, 55, 61, 67, 73, 79, 85, 92, 99, 106, 113, 120, 127, 134, 141, 148, 155, 162, 169, 176, 184, 192, 200, 208, 216, 224, 232, 240, 248, 256, 264, 272, 280, 288, 296, 304, 312, 320, 328, 336, 344, 352, 360, 369, 378, 387, 396, 405, 414, 423, 432
Offset: 0

Views

Author

M. F. Hasler, Oct 25 2019

Keywords

Comments

Useful to express the binary Copeland-Erdős constant, cf. formula.
Plotting a(n) against prime(n) might be a good tool for introducing students of mathematics, particularly those who are familiar with the use of binary representation, to the way the density of prime numbers decreases with increasing size. In essence, the graph of a(n) against prime(n) is approximately linear, and this becomes more obvious if we plot a(n)/prime(n): see the relevant plot in the links. - Peter Munn, Mar 03 2024

Examples

			Primes written in binary (A004676) read: 10, 11, 101, 111, 1011, 1101, 10001, ...
The length of the concatenation of the first n = 0, 1, 2, 3, .... terms is
  0, 2, 4, 7, 10, 14, 18, 23, ...: this sequence.
		

Crossrefs

Cf. A004676 (primes in binary), A035100 (their number of digits), A066747 & A191232: decimals and bits of the binary Copeland-Erdős constant.

Programs

  • Maple
    a := n -> add(ilog2(ithprime(k)), k=1..n) + n:
    seq(a(n), n=0..62); # Peter Luschny, Oct 26 2019
  • Mathematica
    Join[{0}, Accumulate[BitLength[Prime[Range[100]]]]] (* Paolo Xausa, Mar 20 2024 *)
  • PARI
    s=0; A328659=vector(50,n,s+=logint(prime(n),2)+1)
    
  • Python
    from sympy import prime, primerange as primes
    from itertools import accumulate
    def f(n): return len(bin(n)[2:])
    def aupton(nn): return [0]+list(accumulate(map(f, primes(2, prime(nn)+1))))
    print(aupton(62)) # Michael S. Branicky, Jun 26 2021

Formula

a(n) = n + Sum_{k=1..n} floor(log_2(prime(k))).
A066747 = Sum_{n >= 1} prime(n)/2^a(n), the binary Copeland-Erdős constant.
a(n) = a(n-1) + A035100(n), n >= 1.
a(n) = A095375(n) + A345867(n) for n >= 1. - Alois P. Heinz, Jun 28 2021