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.

A095375 Total number of 1's in the binary expansions of the first n primes: summatory A014499.

This page as a plain text file.
%I A095375 #19 Nov 13 2024 17:16:17
%S A095375 1,3,5,8,11,14,16,19,23,27,32,35,38,42,47,51,56,61,64,68,71,76,80,84,
%T A095375 87,91,96,101,106,110,117,120,123,127,131,136,141,145,150,155,160,165,
%U A095375 172,175,179,184,189,196,201,206,211,218,223,230,232,236,240,245,249,253
%N A095375 Total number of 1's in the binary expansions of the first n primes: summatory A014499.
%H A095375 Amiram Eldar, <a href="/A095375/b095375.txt">Table of n, a(n) for n = 1..10000</a>
%e A095375 n=4: first 4 primes={10,11,101,111}, with a(4)=8 digits 1.
%p A095375 read("transforms") :
%p A095375 A095375 := proc(n)
%p A095375     local a;
%p A095375     a := 0 ;
%p A095375     for i from 1 to n do
%p A095375         a := a+wt(ithprime(i)) ;
%p A095375     end do:
%p A095375 end proc: # _R. J. Mathar_, Jul 13 2012
%p A095375 # second Maple program:
%p A095375 a:= proc(n) option remember; `if`(n=0, 0, a(n-1)
%p A095375       +add(i, i=Bits[Split](ithprime(n))))
%p A095375     end:
%p A095375 seq(a(n), n=1..100);  # _Alois P. Heinz_, Jun 26 2021
%t A095375 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
%o A095375 (PARI) a(n)=my(s);forprime(p=2,prime(n),s+=hammingweight(p));s \\ _Charles R Greathouse IV_, Mar 29 2013
%o A095375 (Python)
%o A095375 from sympy import primerange, prime
%o A095375 def A095375(n): return sum(p.bit_count() for p in primerange(prime(n)+1)) # _Chai Wah Wu_, Nov 12 2024
%Y A095375 Cf. A000120, A000788, A079584, A014499.
%K A095375 nonn,base
%O A095375 1,2
%A A095375 _Labos Elemer_, Jun 07 2004