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.

A100922 k appears A000120(k) times (appearances equal number of 1-bits).

This page as a plain text file.
%I A100922 #27 Nov 11 2024 10:47:06
%S A100922 1,2,3,3,4,5,5,6,6,7,7,7,8,9,9,10,10,11,11,11,12,12,13,13,13,14,14,14,
%T A100922 15,15,15,15,16,17,17,18,18,19,19,19,20,20,21,21,21,22,22,22,23,23,23,
%U A100922 23,24,24,25,25,25,26,26,26,27,27,27,27,28,28,28,29,29,29,29,30,30,30,30
%N A100922 k appears A000120(k) times (appearances equal number of 1-bits).
%C A100922 Clearly every positive integer appears at least once in this sequence.
%H A100922 Antti Karttunen, <a href="/A100922/b100922.txt">Table of n, a(n) for n = 0..11264</a>
%F A100922 a(n) = the least k such that A000788(k) > n. - _Antti Karttunen_, Jun 20 2014
%F A100922 Sum_{n>=1} (-1)^(n+1)/a(n) = Sum_{n>=1} (-1)^(n+1)/A000069(n) = 0.67968268... . - _Amiram Eldar_, Feb 18 2024
%e A100922 The binary representation of 16 is 10000, which has one 1-bit (and four 0-bits), hence 16 appears once in this sequence (and four times in A100921).
%p A100922 T:= n-> n$add(i, i=Bits[Split](n)):
%p A100922 seq(T(n), n=1..30);  # _Alois P. Heinz_, Nov 11 2024
%t A100922 Table[Table[n,DigitCount[n,2,1]],{n,30}]//Flatten (* _Harvey P. Dale_, Aug 31 2017 *)
%o A100922 (Scheme, with _Antti Karttunen_'s IntSeq-library)
%o A100922 (define A100922 (COMPOSE (LEAST-GTE-I 1 1 A000788) 1+))
%o A100922 (Python)
%o A100922 def A000788(n): return (n+1)*n.bit_count()+(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 A100922 def A100922(n):
%o A100922     if n == 0: return 1
%o A100922     m, k = 1, 1
%o A100922     while A000788(m)<=n: m<<=1
%o A100922     while m-k>1:
%o A100922         r = m+k>>1
%o A100922         if A000788(r)>n:
%o A100922             m = r
%o A100922         else:
%o A100922             k = r
%o A100922     return m # _Chai Wah Wu_, Nov 11 2024
%Y A100922 Cf. A100921 (n's appearances equal its number of 0-bits), A030530 (n's appearances equal its total number of bits), A227737 (n's appearances equal its total number of runs), A000069, A000120, A000788, A163510, A243067.
%K A100922 base,easy,nonn,tabf
%O A100922 0,2
%A A100922 _Rick L. Shepherd_, Nov 21 2004