%I #34 Nov 05 2024 13:53:32
%S 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,
%T 27,27,27,27,27,27,27,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,
%U 58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,121,121,121
%N a(n) = 2^bil(n) - bil(n) where bil(0) = 0 and bil(n) = floor(log_2(n)) + 1 for n > 0.
%C Also a(n) is the major index plus one of the n-th Eytzinger permutation. - _Darío Clavijo_, Nov 04 2024
%H Robert Israel, <a href="/A295514/b295514.txt">Table of n, a(n) for n = 0..10000</a>
%H Sergey Slotin, <a href="https://algorithmica.org/en/eytzinger">Eytzinger binary search</a>
%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Major_index">Major index</a>
%F From _Robert Israel_, Dec 03 2017: (Start)
%F G.f.: (1-x)^(-1)*(1+Sum_{k>=0} (2^k-1)*x^(2^k)).
%F a(n) = 4*a(floor(n/2)) - 5*a(floor(n/4)) + 2*a(floor(n/8)) for n >= 4. (End)
%F a(n) = A000325(A029837(n)) = A000325(A070939(n)). - _Michel Marcus_, Nov 05 2024
%p 1,seq((2^k-k)$(2^(k-1)),k=1..8); # _Robert Israel_, Dec 03 2017
%t a[n_] := 2^IntegerLength[n, 2] - IntegerLength[n, 2];
%t Table[a[n], {n, 0, 58}]
%o (Python)
%o bil = lambda n: n.bit_length()
%o a = lambda n: (1 << bil(n)) - bil(n)
%o print([a(n) for n in range(0, 67)]) # _Darío Clavijo_, Nov 05 2024
%Y Cf. A000325, A029837, A070939.
%K nonn
%O 0,3
%A _Peter Luschny_, Dec 02 2017