OFFSET
1,2
LINKS
Amiram Eldar, Table of n, a(n) for n = 1..10000
EXAMPLE
n=4: first 4 primes={10,11,101,111}, with a(4)=8 digits 1.
MAPLE
read("transforms") :
A095375 := proc(n)
local a;
a := 0 ;
for i from 1 to n do
a := a+wt(ithprime(i)) ;
end do:
end proc: # R. J. Mathar, Jul 13 2012
# second Maple program:
a:= proc(n) option remember; `if`(n=0, 0, a(n-1)
+add(i, i=Bits[Split](ithprime(n))))
end:
seq(a(n), n=1..100); # Alois P. Heinz, Jun 26 2021
MATHEMATICA
lib[x_] :=Count[IntegerDigits[x, 2], 1] {s=0, ta=Table[0, {256}]}; Do[s=s+lib[Prime[n]]; ta[[n]]=s, {n, 1, 256}] ta
PROG
(PARI) a(n)=my(s); forprime(p=2, prime(n), s+=hammingweight(p)); s \\ Charles R Greathouse IV, Mar 29 2013
(Python)
from sympy import primerange, prime
def A095375(n): return sum(p.bit_count() for p in primerange(prime(n)+1)) # Chai Wah Wu, Nov 12 2024
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Labos Elemer, Jun 07 2004
STATUS
approved