OFFSET
1,2
COMMENTS
To compute a(n):
- the binary representation of n has k = A000120(n) one bits,
- the binary representation of a(n) has k runs of consecutive equal bits,
- the length of the i-th run in a(n) has length 2^z where z is the number of zeros immediately following the i-th one bit in the binary representation of n,
- this division into sections starting with ones in n or corresponding to a run in a(n) is materialized by slashes in the example section.
EXAMPLE
The first terms, alongside the binary representation of n and of a(n) with peer sections separated by slashes, are:
n a(n) bin(n) bin(a(n))
-- ----- ------- ----------------
1 1 1 1
2 3 10 11
3 2 1/1 1/0
4 15 100 1111
5 6 10/1 11/0
6 4 1/10 1/00
7 5 1/1/1 1/0/1
8 255 1000 11111111
9 30 100/1 1111/0
10 12 10/10 11/00
11 13 10/1/1 11/0/1
12 16 1/100 1/0000
13 9 1/10/1 1/00/1
14 11 1/1/10 1/0/11
15 10 1/1/1/1 1/0/1/0
16 65535 10000 1111111111111111
PROG
(PARI) a(n)={ my (r=[], l, v=0); while (n, r=concat(l=1+valuation(n, 2), r); n \= 2^l); for (i=1, #r, v *= 2^2^(r[i]-1); if (i%2, v += 2^2^(r[i]-1)-1)); v }
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Oct 11 2019
STATUS
approved