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

 


Write n in binary; a(n) = number of 1's in second block of 1's from right.
3

%I #7 Jun 07 2013 13:35:28

%S 0,0,0,0,0,1,0,0,0,1,1,1,0,2,0,0,0,1,1,1,1,1,1,1,0,2,2,2,0,3,0,0,0,1,

%T 1,1,1,1,1,1,1,1,1,1,1,2,1,1,0,2,2,2,2,1,2,2,0,3,3,3,0,4,0,0,0,1,1,1,

%U 1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,2,2,2,1,3,1,1,0,2,2,2

%N Write n in binary; a(n) = number of 1's in second block of 1's from right.

%e 13 = 1101 so a(13) = 2.

%o (PARI) a(n)=local(b,c,s):b=binary(n):c=length(b):while(!b[c],c=c-1):while(c>0&&b[c],c=c-1): if(c<=0,0, while(!b[c],c=c-1):s=0:while(c>0&&b[c],c=c-1:s=s+1):s) /* _Ralf Stephan_ */

%Y Cf. A089309-A089313.

%K nonn,base

%O 0,14

%A _N. J. A. Sloane_, Dec 22 2003

%E More terms from _Ralf Stephan_, Feb 01 2004

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | 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 September 24 14:52 EDT 2024. Contains 376200 sequences. (Running on oeis4.)