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.

A089265 a(1) = 0; thereafter a(2*n) = a(n) + 1, a(2*n+1) = 2*n.

This page as a plain text file.
%I A089265 #18 Feb 28 2019 11:22:22
%S A089265 0,1,2,2,4,3,6,3,8,5,10,4,12,7,14,4,16,9,18,6,20,11,22,5,24,13,26,8,
%T A089265 28,15,30,5,32,17,34,10,36,19,38,7,40,21,42,12,44,23,46,6,48,25,50,14,
%U A089265 52,27,54,9,56,29,58,16,60,31,62,6,64,33,66,18,68,35,70,11,72
%N A089265 a(1) = 0; thereafter a(2*n) = a(n) + 1, a(2*n+1) = 2*n.
%C A089265 In the binary representation of n, swallow all zeros from the right, then add the number of swallowed zeros, and subtract 1. - _Ralf Stephan_, Aug 22 2013
%H A089265 T. D. Noe, <a href="/A089265/b089265.txt">Table of n, a(n) for n=1..1000</a>
%H A089265 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>
%F A089265 a(1) = 0; thereafter a(2*n) = a(n) + 1, a(2*n+1) = 2*n.
%F A089265 a(n) = A007814(n) + 2*A025480(n-1) = A007814(n) + A000265(n) - 1.
%F A089265 G.f.: sum(k>=0, (t^2+2t^3-t^4)/(1-t^2)^2, t=(x^2)^k).
%F A089265 a((2*n-1)*2^p) = p + 2*(n-1), p >= 0. - _Johannes W. Meijer_, Jan 23 2013
%p A089265 nmax:=73: for p from 0 to ceil(simplify(log[2](nmax))) do for n from 1 to ceil(nmax/(p+2)) do a((2*n-1)*2^p) := p  + 2*(n-1) od: od: seq(a(n), n=1..nmax); # _Johannes W. Meijer_, Jan 23 2013
%t A089265 a[n_] := With[{v = IntegerExponent[n, 2]}, v + n/2^v - 1];
%t A089265 Array[a, 100] (* _Jean-François Alcover_, Feb 28 2019 *)
%o A089265 (PARI) a(n) = valuation(n,2) + n/2^valuation(n,2) - 1
%Y A089265 First differences of A005766.
%Y A089265 Cf. A003602, A220466.
%K A089265 nonn,easy
%O A089265 1,3
%A A089265 _Ralf Stephan_, Oct 30 2003