This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A089310 #19 Aug 04 2025 02:45:48 %S A089310 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 A089310 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 A089310 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 A089310 Write n in binary; a(n) = number of 1's in second block of 1's from right. %H A089310 Robert Israel, <a href="/A089310/b089310.txt">Table of n, a(n) for n = 0..10000</a> %e A089310 13 = 1101 so a(13) = 2. %p A089310 f:= proc(n) local t,q,r; %p A089310 r:= 0: t:= n; %p A089310 while t::even do t:= t/2 od; %p A089310 while t::odd do t:= (t-1)/2 od; %p A089310 if t = 0 then return 0 fi; %p A089310 while t::even do t:= t/2 od; %p A089310 while t::odd do r:= r+1; t:= (t-1)/2 od; %p A089310 r %p A089310 end proc: %p A089310 f(0):= 0: %p A089310 map(f, [$0..100]); # _Robert Israel_, Aug 03 2025 %o A089310 (PARI) a(n)=my(b, c, s); if(n==0,return(0)); 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_, Feb 01 2004 */ %Y A089310 Cf. A089309, A089311, A089312, A089313. %K A089310 nonn,base %O A089310 0,14 %A A089310 _N. J. A. Sloane_, Dec 22 2003 %E A089310 More terms from _Ralf Stephan_, Feb 01 2004