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.

A345867 Total number of 0's in the binary expansions of the first n primes.

This page as a plain text file.
%I A345867 #20 Feb 26 2024 10:43:35
%S A345867 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,
%T A345867 50,52,54,56,59,59,64,69,73,77,80,83,87,90,93,96,99,100,105,109,112,
%U A345867 115,116,119,122,125,126,129,130,137,142,147,151,156,161,165,170
%N A345867 Total number of 0's in the binary expansions of the first n primes.
%H A345867 Alois P. Heinz, <a href="/A345867/b345867.txt">Table of n, a(n) for n = 1..20000</a>
%F A345867 a(n) = Sum_{i=1..n} A035103(i).
%F A345867 a(n) = a(n-1) for n in { A059305 }.
%F A345867 a(n) = A328659(n) - A095375(n).
%e A345867 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.
%p A345867 a:= proc(n) option remember; `if`(n=0, 0, a(n-1)
%p A345867       +add(1-i, i=Bits[Split](ithprime(n))))
%p A345867     end:
%p A345867 seq(a(n), n=1..100);
%t A345867 Accumulate[DigitCount[Prime[Range[100]], 2, 0]] (* _Paolo Xausa_, Feb 26 2024 *)
%o A345867 (Python)
%o A345867 from sympy import prime, primerange
%o A345867 from itertools import accumulate
%o A345867 def f(n): return (bin(n)[2:]).count('0')
%o A345867 def aupton(nn): return list(accumulate(map(f, primerange(2, prime(nn)+1))))
%o A345867 print(aupton(62)) # _Michael S. Branicky_, Jun 26 2021
%Y A345867 Partial sums of A035103.
%Y A345867 Cf. A000040, A059305, A095375, A328659.
%K A345867 nonn,base
%O A345867 1,3
%A A345867 _Alois P. Heinz_, Jun 26 2021