OFFSET
1,2
COMMENTS
See comments on A266201 for the definition of hereditary representation.
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..65537
EXAMPLE
A table of n, the binary hereditary representation of 2n, and the number of 2s in the representation:
n | hereditary rep. of 2n | number of 2s
---+-------------------------+--------------
1 | 2 | 1
2 | 2^2 | 2
3 | 2^2+2 | 3
4 | 2^(2+1) | 2
5 | 2^(2+1)+2 | 3
6 | 2^(2+1)+2^2 | 4
7 | 2^(2+1)+2^2+2 | 5
8 | 2^2^2 | 3
9 | 2^2^2+2 | 4
10 | 2^2^2+2^2 | 5
11 | 2^2^2+2^2+2 | 6
12 | 2^2^2+2^(2+1) | 5
13 | 2^2^2+2^(2+1)+2 | 6
14 | 2^2^2+2^(2+1)+2^2 | 7
15 | 2^2^2+2^(2+1)+2^2+2 | 8
16 | 2^(2^2+1) | 3
17 | 2^(2^2+1)+2 | 4
18 | 2^(2^2+1)+2^2 | 5
19 | 2^(2^2+1)+2^2+2 | 6
20 | 2^(2^2+1)+2^(2+1) | 5
21 | 2^(2^2+1)+2^(2+1)+2 | 6
22 | 2^(2^2+1)+2^(2+1)+2^2 | 7
23 | 2^(2^2+1)+2^(2+1)+2^2+2 | 8
24 | 2^(2^2+1)+2^2^2 | 6
25 | 2^(2^2+1)+2^2^2+2 | 7
26 | 2^(2^2+1)+2^2^2+2^2 | 8
27 | 2^(2^2+1)+2^2^2+2^2+2 | 9
28 | 2^(2^2+1)+2^2^2+2^(2+1) | 8
PROG
(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
CROSSREFS
KEYWORD
AUTHOR
Jodi Spitz, Mar 26 2023
STATUS
approved