OFFSET
1,3
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..20000
FORMULA
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
KEYWORD
nonn,base
AUTHOR
Alois P. Heinz, Jun 26 2021
STATUS
approved