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.

A168156 Sum of the binary digits of all primes between 2^(n-1) and 2^n-1, i.e., with exactly n binary digits.

This page as a plain text file.
%I A168156 #19 Apr 07 2020 12:45:39
%S A168156 0,3,5,6,18,29,56,113,240,452,885,1790,3474,6951,13671,27183,54201,
%T A168156 107224,213882,424513,845716,1682456,3350362,6671581,13299828,
%U A168156 26500297,52829961,105342821,210088965,419106389,836097752,1668341390,3329412989,6645128078
%N A168156 Sum of the binary digits of all primes between 2^(n-1) and 2^n-1, i.e., with exactly n binary digits.
%C A168156 Sequence A168155 yields the partial sums.
%e A168156 No prime can be written with only 1 binary digit, thus a(1)=0.
%e A168156 The primes that can be written with 2 binary digits are 2 = 10[2] and 3 = 11[2], they have 3 nonzero bits, so a(2)=3.
%e A168156 Primes with 3 binary digits are 5 = 101[2] and 7 = 111[3]. They have a total of a(3)=5 nonzero bits.
%o A168156 (PARI) s=0; L=p=2; while( L*=2, print1(s", "); s=0; until( L<p=nextprime(p+1), s+=norml2(binary(p))))
%o A168156 (PARI) a(n)=my(s); forprime(p=2^(n-1),2^n-1, s+=hammingweight(p)); s \\ _Charles R Greathouse IV_, Apr 07 2020
%Y A168156 Cf. A086904.
%K A168156 nonn,base
%O A168156 1,2
%A A168156 _M. F. Hasler_, Nov 20 2009
%E A168156 a(26)-a(32) from _Donovan Johnson_, Jul 28 2010
%E A168156 a(33) from _Chai Wah Wu_, Apr 06 2020
%E A168156 a(34) from _Chai Wah Wu_, Apr 07 2020