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.

A100921 n appears A023416(n) times (appearances equal number of 0-bits).

This page as a plain text file.
%I A100921 #12 Nov 11 2024 22:27:07
%S A100921 0,2,4,4,5,6,8,8,8,9,9,10,10,11,12,12,13,14,16,16,16,16,17,17,17,18,
%T A100921 18,18,19,19,20,20,20,21,21,22,22,23,24,24,24,25,25,26,26,27,28,28,29,
%U A100921 30,32,32,32,32,32,33,33,33,33,34,34,34,34,35,35,35,36,36,36,36,37,37,37
%N A100921 n appears A023416(n) times (appearances equal number of 0-bits).
%F A100921 Sum_{n>=1} (-1)^(n+1)/a(n) = Sum_{n>=1} (-1)^(n+1)/A059009(n) = 0.395592509... . - _Amiram Eldar_, Feb 18 2024
%e A100921 The binary representation of 16 is 10000, which has four 0-bits (and one 1-bit), hence 16 appears four times in this sequence (but only once in A100922).
%t A100921 Flatten[Table[Table[n, {DigitCount[n, 2, 0]}], {n, 0, 37}]] (* _Amiram Eldar_, Feb 18 2024 *)
%o A100921 (Python)
%o A100921 def A059015(n): return 2+(n+1)*((t:=(n+1).bit_length())-n.bit_count())-(1<<t)-(sum((m:=1<<j)*((k:=n>>j)-(r if n<<1>=m*(r:=k<<1|1) else 0)) for j in range(1,n.bit_length()+1))>>1)
%o A100921 def A100921(n):
%o A100921     if n == 0: return 0
%o A100921     m, k = 1, 1
%o A100921     while A059015(m)<=n: m<<=1
%o A100921     while m-k>1:
%o A100921         r = m+k>>1
%o A100921         if A059015(r)>n:
%o A100921             m = r
%o A100921         else:
%o A100921             k = r
%o A100921     return m  # _Chai Wah Wu_, Nov 11 2024
%Y A100921 Cf. A100922 (n's appearances equal its number of 1-bits), A030530 (n's appearances equal its total number of bits), A023416, A059009.
%K A100921 base,easy,nonn
%O A100921 0,2
%A A100921 _Rick L. Shepherd_, Nov 21 2004