login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A049501 Major index of n, first definition. 10

%I #20 Feb 19 2023 11:58:42

%S 0,0,1,0,1,1,2,0,1,1,4,1,2,2,3,0,1,1,5,1,4,4,5,1,2,2,6,2,3,3,4,0,1,1,

%T 6,1,5,5,6,1,4,4,9,4,5,5,6,1,2,2,7,2,6,6,7,2,3,3,8,3,4,4,5,0,1,1,7,1,

%U 6,6,7,1,5,5,11,5,6,6,7,1,4,4,10,4,9,9,10,4,5,5,11,5,6,6,7,1,2,2,8,2,7,7,8

%N Major index of n, first definition.

%D D. M. Bressoud, Proofs and Confirmations, Camb. Univ. Press, 1999; cf. p. 89.

%H J. Stauduhar, <a href="/A049501/b049501.txt">Table of n, a(n) for n = 0..10000</a>

%F Write n in binary; sum the positions where there is a '1' followed immediately to the right by a '0', counting the leftmost digit as position '1'.

%e 50 = 110010 has 1's followed by 0's in positions 2 and 5 (reading from the left), so a(50)=7. At the beginning of the sequence we have 0->0, 1->0, 10->1, 11->0, 100->1, 101->1, 110->2, 111->0, 1000->1, 1001->1, 1010->1+3=4, ...

%t a[n_] := Total[ Flatten[ Position[ IntegerDigits[n, 2] //. {b___, 1, 0, c___} -> {b, 2, 3, c}, 2]]]; Table[a[n], {n, 0, 102}] (* _Jean-François Alcover_, Dec 20 2011 *)

%t Table[Total[Flatten[Position[Partition[IntegerDigits[n,2],2,1],{1,0}]]],{n,0,110}] (* _Harvey P. Dale_, Nov 04 2012 *)

%t Table[Total[SequencePosition[IntegerDigits[n,2],{1,0}][[;;,1]]],{n,0,110}] (* _Harvey P. Dale_, Feb 19 2023 *)

%Y Cf. A049502.

%K nonn,base,nice,easy

%O 0,7

%A _N. J. A. Sloane_

%E More terms from _Erich Friedman_, Feb 19 2000

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 29 00:26 EDT 2024. Contains 371264 sequences. (Running on oeis4.)