# Greetings from The On-Line Encyclopedia of Integer Sequences! http://oeis.org/ Search: id:a295514 Showing 1-1 of 1 %I A295514 #34 Nov 05 2024 13:53:32 %S A295514 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 A295514 27,27,27,27,27,27,27,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58, %U A295514 58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,121,121,121 %N A295514 a(n) = 2^bil(n) - bil(n) where bil(0) = 0 and bil(n) = floor(log_2(n)) + 1 for n > 0. %C A295514 Also a(n) is the major index plus one of the n-th Eytzinger permutation. - _Darío Clavijo_, Nov 04 2024 %H A295514 Robert Israel, Table of n, a(n) for n = 0..10000 %H A295514 Sergey Slotin, Eytzinger binary search %H A295514 Wikipedia, Major index %F A295514 From _Robert Israel_, Dec 03 2017: (Start) %F A295514 G.f.: (1-x)^(-1)*(1+Sum_{k>=0} (2^k-1)*x^(2^k)). %F A295514 a(n) = 4*a(floor(n/2)) - 5*a(floor(n/4)) + 2*a(floor(n/8)) for n >= 4. (End) %F A295514 a(n) = A000325(A029837(n)) = A000325(A070939(n)). - _Michel Marcus_, Nov 05 2024 %p A295514 1,seq((2^k-k)$(2^(k-1)),k=1..8); # _Robert Israel_, Dec 03 2017 %t A295514 a[n_] := 2^IntegerLength[n, 2] - IntegerLength[n, 2]; %t A295514 Table[a[n], {n, 0, 58}] %o A295514 (Python) %o A295514 bil = lambda n: n.bit_length() %o A295514 a = lambda n: (1 << bil(n)) - bil(n) %o A295514 print([a(n) for n in range(0, 67)]) # _Darío Clavijo_, Nov 05 2024 %Y A295514 Cf. A000325, A029837, A070939. %K A295514 nonn %O A295514 0,3 %A A295514 _Peter Luschny_, Dec 02 2017 # Content is available under The OEIS End-User License Agreement: http://oeis.org/LICENSE