login
A345867
Total number of 0's in the binary expansions of the first n primes.
2
1, 1, 2, 2, 3, 4, 7, 9, 10, 11, 11, 14, 17, 19, 20, 22, 23, 24, 28, 31, 35, 37, 40, 43, 47, 50, 52, 54, 56, 59, 59, 64, 69, 73, 77, 80, 83, 87, 90, 93, 96, 99, 100, 105, 109, 112, 115, 116, 119, 122, 125, 126, 129, 130, 137, 142, 147, 151, 156, 161, 165, 170
OFFSET
1,3
LINKS
FORMULA
a(n) = Sum_{i=1..n} A035103(i).
a(n) = a(n-1) for n in { A059305 }.
a(n) = A328659(n) - A095375(n).
EXAMPLE
a(3) = 2: 2 = 10_2, 3 = 11_2, 5 = 101_2, so there are two 0's in the binary expansions of the first three primes.
MAPLE
a:= proc(n) option remember; `if`(n=0, 0, a(n-1)
+add(1-i, i=Bits[Split](ithprime(n))))
end:
seq(a(n), n=1..100);
MATHEMATICA
Accumulate[DigitCount[Prime[Range[100]], 2, 0]] (* Paolo Xausa, Feb 26 2024 *)
PROG
(Python)
from sympy import prime, primerange
from itertools import accumulate
def f(n): return (bin(n)[2:]).count('0')
def aupton(nn): return list(accumulate(map(f, primerange(2, prime(nn)+1))))
print(aupton(62)) # Michael S. Branicky, Jun 26 2021
CROSSREFS
Partial sums of A035103.
Sequence in context: A091605 A145468 A125554 * A252796 A083130 A083129
KEYWORD
nonn,base
AUTHOR
Alois P. Heinz, Jun 26 2021
STATUS
approved