login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A216685 a(n) is the number of 1's in binary expansion of n + a(n-1), with a(0)=0. 1

%I #15 Jul 22 2023 17:34:15

%S 0,1,2,2,2,3,2,2,2,3,3,3,4,2,1,1,2,3,3,3,4,3,3,3,4,4,4,5,2,5,3,2,2,3,

%T 3,3,4,3,3,3,4,4,4,5,3,2,2,3,4,4,4,5,4,4,4,5,5,5,6,2,5,2,1,1,2,3,3,3,

%U 4,3,3,3,4,4,4,5,3,2,2,3,4,4,4,5,4,4,4

%N a(n) is the number of 1's in binary expansion of n + a(n-1), with a(0)=0.

%C Indices of 1's: 1, 14, 15, 62, 63, 254, 255, 2045, 4087, 32766, 32767, 65523, 131069, 262129, 524272, 524286, 524287, 2097149, 8388605, 16777195, 16777212, ...

%H Amiram Eldar, <a href="/A216685/b216685.txt">Table of n, a(n) for n = 0..10000</a>

%F a(0) = 0, a(n) = A000120(n+a(n-1)).

%t a[0] = 0; a[n_] := a[n] = DigitCount[n + a[n - 1], 2, 1]; Array[a, 100, 0] (* _Amiram Eldar_, Jul 22 2023 *)

%o (Python)

%o a=0

%o for n in range(1,333):

%o print a,

%o x = a+n

%o a = 0

%o while x:

%o a += x & 1

%o x >>= 1

%Y Cf. A000120.

%K nonn,base

%O 0,3

%A _Alex Ratushnyak_, Sep 14 2012

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 16 05:57 EDT 2024. Contains 375959 sequences. (Running on oeis4.)