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.

A290255 Number of 0's following directly the first 1 in the binary representation of n.

This page as a plain text file.
%I A290255 #14 Nov 20 2022 04:57:07
%S A290255 0,1,0,2,1,0,0,3,2,1,1,0,0,0,0,4,3,2,2,1,1,1,1,0,0,0,0,0,0,0,0,5,4,3,
%T A290255 3,2,2,2,2,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,5,4,4,3,
%U A290255 3,3,3,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0
%N A290255 Number of 0's following directly the first 1 in the binary representation of n.
%H A290255 Robert Israel, <a href="/A290255/b290255.txt">Table of n, a(n) for n = 1..10000</a>
%F A290255 a(2^k)= k (k>=0); otherwise, a(n) = a(floor(n/2)).
%F A290255 G.f. q(x) + Sum_{j>=1} q(x^(2^j))*(x^(2^j)-x^(2^(j-1)))/(x-1) where q(z) = Sum_{j>=1} j*x^(2^j). - _Robert Israel_, Sep 03 2017
%e A290255 a(19) = 2 because 19_2 = 10'0'11; a(21) = 1 because 21_2 = 10'101_2 (the counted 0's are marked).
%p A290255 a := proc (n) if type(log[2](n), integer) = true then log[2](n) else a(floor((1/2)*n)) end if end proc: seq(a(n), n = 1 .. 200);
%p A290255 # Alternate:
%p A290255 f := proc(n) option remember; local v;
%p A290255 v:= padic:-ordp(n,2);
%p A290255   if n = 2^v then v else procname((n-2^v)/2^(v+1)) fi
%p A290255 end proc:
%p A290255 map(f, [$1..1000]); # _Robert Israel_, Sep 03 2017
%t A290255 sfo[n_]:=Module[{sidn2=Split[IntegerDigits[n,2]]},If[Length[ sidn2[[1]]]> 1, 0, Length[ sidn2[[2]]]]]; Join[{0},Array[sfo,110,2]] (* _Harvey P. Dale_, Mar 04 2018 *)
%K A290255 nonn,base
%O A290255 1,4
%A A290255 _Emeric Deutsch_, Sep 03 2017