login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

a(n) is the number of 2s in the binary hereditary representation of 2n.
1

%I #16 Jun 04 2024 14:24:05

%S 1,2,3,2,3,4,5,3,4,5,6,5,6,7,8,3,4,5,6,5,6,7,8,6,7,8,9,8,9,10,11,4,5,

%T 6,7,6,7,8,9,7,8,9,10,9,10,11,12,7,8,9,10,9,10,11,12,10,11,12,13,12,

%U 13,14,15,4,5,6,7,6,7,8,9,7,8,9,10,9,10,11,12,7

%N a(n) is the number of 2s in the binary hereditary representation of 2n.

%C See comments on A266201 for the definition of hereditary representation.

%H Antti Karttunen, <a href="/A361838/b361838.txt">Table of n, a(n) for n = 1..65537</a>

%e A table of n, the binary hereditary representation of 2n, and the number of 2s in the representation:

%e n | hereditary rep. of 2n | number of 2s

%e ---+-------------------------+--------------

%e 1 | 2 | 1

%e 2 | 2^2 | 2

%e 3 | 2^2+2 | 3

%e 4 | 2^(2+1) | 2

%e 5 | 2^(2+1)+2 | 3

%e 6 | 2^(2+1)+2^2 | 4

%e 7 | 2^(2+1)+2^2+2 | 5

%e 8 | 2^2^2 | 3

%e 9 | 2^2^2+2 | 4

%e 10 | 2^2^2+2^2 | 5

%e 11 | 2^2^2+2^2+2 | 6

%e 12 | 2^2^2+2^(2+1) | 5

%e 13 | 2^2^2+2^(2+1)+2 | 6

%e 14 | 2^2^2+2^(2+1)+2^2 | 7

%e 15 | 2^2^2+2^(2+1)+2^2+2 | 8

%e 16 | 2^(2^2+1) | 3

%e 17 | 2^(2^2+1)+2 | 4

%e 18 | 2^(2^2+1)+2^2 | 5

%e 19 | 2^(2^2+1)+2^2+2 | 6

%e 20 | 2^(2^2+1)+2^(2+1) | 5

%e 21 | 2^(2^2+1)+2^(2+1)+2 | 6

%e 22 | 2^(2^2+1)+2^(2+1)+2^2 | 7

%e 23 | 2^(2^2+1)+2^(2+1)+2^2+2 | 8

%e 24 | 2^(2^2+1)+2^2^2 | 6

%e 25 | 2^(2^2+1)+2^2^2+2 | 7

%e 26 | 2^(2^2+1)+2^2^2+2^2 | 8

%e 27 | 2^(2^2+1)+2^2^2+2^2+2 | 9

%e 28 | 2^(2^2+1)+2^2^2+2^(2+1) | 8

%o (PARI) a(n)=if(n==0, 0, sum(k=0, logint(n,2), if(bittest(n,k), 1 + a((k+1)\2)))) \\ _Andrew Howroyd_, Apr 07 2023

%Y Cf. A005245, A025280.

%K nonn,base,hear

%O 1,2

%A _Jodi Spitz_, Mar 26 2023