login
A295514
a(n) = 2^bil(n) - bil(n) where bil(0) = 0 and bil(n) = floor(log_2(n)) + 1 for n > 0.
1
1, 1, 2, 2, 5, 5, 5, 5, 12, 12, 12, 12, 12, 12, 12, 12, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 121, 121, 121
OFFSET
0,3
COMMENTS
Also a(n) is the major index plus one of the n-th Eytzinger permutation. - Darío Clavijo, Nov 04 2024
LINKS
Wikipedia, Major index
FORMULA
From Robert Israel, Dec 03 2017: (Start)
G.f.: (1-x)^(-1)*(1+Sum_{k>=0} (2^k-1)*x^(2^k)).
a(n) = 4*a(floor(n/2)) - 5*a(floor(n/4)) + 2*a(floor(n/8)) for n >= 4. (End)
a(n) = A000325(A029837(n)) = A000325(A070939(n)). - Michel Marcus, Nov 05 2024
MAPLE
1, seq((2^k-k)$(2^(k-1)), k=1..8); # Robert Israel, Dec 03 2017
MATHEMATICA
a[n_] := 2^IntegerLength[n, 2] - IntegerLength[n, 2];
Table[a[n], {n, 0, 58}]
PROG
(Python)
bil = lambda n: n.bit_length()
a = lambda n: (1 << bil(n)) - bil(n)
print([a(n) for n in range(0, 67)]) # Darío Clavijo, Nov 05 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Peter Luschny, Dec 02 2017
STATUS
approved