cp's OEIS Frontend

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.

A089313 Write n in binary; a(n) = number represented by second block of 1's from the right.

This page as a plain text file.
%I A089313 #16 Aug 04 2025 02:47:28
%S A089313 0,0,0,0,0,1,0,0,0,1,1,1,0,3,0,0,0,1,1,1,1,1,1,1,0,3,3,3,0,7,0,0,0,1,
%T A089313 1,1,1,1,1,1,1,1,1,1,1,3,1,1,0,3,3,3,3,1,3,3,0,7,7,7,0,15,0,0,0,1,1,1,
%U A089313 1,1,1,1,1,1,1,1,1,3,1,1,1,1,1,1,1,1,1,1,1,3,3,3,1,7,1,1,0,3,3,3,3,1,3,3,3,1,1,1,3,3,3,3,0,7,7,7,7,1,7,7,0
%N A089313 Write n in binary; a(n) = number represented by second block of 1's from the right.
%H A089313 Robert Israel, <a href="/A089313/b089313.txt">Table of n, a(n) for n = 0..10000</a>
%F A089313 a(n) = 2^A089310(n)-1. - _David Wasserman_, Sep 09 2005
%e A089313 13 = 1101 so a(13) = 3.
%p A089313 f:= proc(n) local t,q,r;
%p A089313   r:= 0: t:= n;
%p A089313   while t::even do t:= t/2 od;
%p A089313   while t::odd do t:= (t-1)/2 od;
%p A089313   if t = 0 then return 0 fi;
%p A089313   while t::even do t:= t/2 od;
%p A089313   while t::odd do r:= 2*r+1; t:= (t-1)/2 od;
%p A089313   r
%p A089313 end proc:
%p A089313 f(0):= 0:
%p A089313 map(f, [$0..120]); # _Robert Israel_, Aug 03 2025
%t A089313 sb1[n_]:=With[{c=If[#[[1]]==0,Nothing,#]&/@Split[IntegerDigits[n,2]]},If[Length[c]==1,0,FromDigits[c[[-2]],2]]]; Join[{0},Table[sb1[n],{n,120}]] (* _Harvey P. Dale_, Aug 02 2025 *)
%o A089313 (PARI) { a(n) = local(b,l,r,c); b=binary(n); l=length(b); while(l&&b[l]==0,l--); while(l&&b[l]==1,l--); while(l&&b[l]==0,l--); r=0; c=0; while(l&&b[l],r+=2^c;l--;c++); r; }
%o A089313 for(i=0,200,print1(a(i),", ")) \\ Lambert Klasen (Lambert.Klasen(AT)gmx.net), Sep 09 2005
%Y A089313 Cf. A089309, A089310, A089311, A089312.
%K A089313 nonn,base
%O A089313 0,14
%A A089313 _N. J. A. Sloane_, Dec 22 2003
%E A089313 More terms from _David Wasserman_ and Lambert Klasen (Lambert.Klasen(AT)gmx.net), Sep 09 2005
%E A089313 Corrected and extended by _Harvey P. Dale_, Aug 02 2025