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.

A136480 Number of trailing equal digits in binary representation of n.

This page as a plain text file.
%I A136480 #47 Mar 20 2023 05:30:48
%S A136480 1,1,1,2,2,1,1,3,3,1,1,2,2,1,1,4,4,1,1,2,2,1,1,3,3,1,1,2,2,1,1,5,5,1,
%T A136480 1,2,2,1,1,3,3,1,1,2,2,1,1,4,4,1,1,2,2,1,1,3,3,1,1,2,2,1,1,6,6,1,1,2,
%U A136480 2,1,1,3,3,1,1,2,2,1,1,4,4,1,1,2,2,1,1,3,3,1,1,2,2,1,1,5,5,1,1,2,2,1,1,3,3
%N A136480 Number of trailing equal digits in binary representation of n.
%C A136480 a(even) = number of trailing binary zeros;
%C A136480 a(odd) = number of trailing binary ones.
%C A136480 For n>0, power of 2 associated with n^2 + n, e.g. n=4 gives 20, so a(4)=2. - _Jon Perry_, Sep 12 2014
%H A136480 James Spahlinger, <a href="/A136480/b136480.txt">Table of n, a(n) for n = 0..10000</a>
%H A136480 Francis Laclé, <a href="https://hal.archives-ouvertes.fr/hal-03201180v2">2-adic parity explorations of the 3n+ 1 problem</a>, hal-03201180v2 [cs.DM], 2021.
%H A136480 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>
%F A136480 a(n) = A050603(n-1) for n>0;
%F A136480 a(2*n + n mod 2) = a(n) + 1.
%F A136480 For n>0: a(n) = A007814(n + n mod 2).
%F A136480 Asymptotic mean: lim_{m->oo} (1/m) * Sum_{k=0..m} a(k) = 2. - _Amiram Eldar_, Sep 15 2022
%F A136480 a(n) = A007814(A002378(n)), n>0. - _R. J. Mathar_, Mar 20 2023
%p A136480 A136480 := proc(n)
%p A136480     if n = 0 then
%p A136480         1;
%p A136480     else
%p A136480         A007814(n*(n+1)) ;
%p A136480     end if;
%p A136480 end proc:
%p A136480 seq( A136480(n),n=0..80) ; # _R. J. Mathar_, Mar 20 2023
%t A136480 Length[Last[Split[IntegerDigits[#,2]]]]&/@Range[0,140]  (* _Harvey P. Dale_, Mar 31 2011 *)
%o A136480 (PARI) a(n)=if (n, valuation(n+n%2,2), 1) \\ _Charles R Greathouse IV_, Oct 14 2013
%o A136480 (Haskell)
%o A136480 a136480 0 = 1
%o A136480 a136480 n = a007814 $ n + mod n 2  -- _Reinhard Zumkeller_, Jul 22 2014
%o A136480 (JavaScript)
%o A136480 for (n=1;n<120;n++) {
%o A136480 m=n*n+n;
%o A136480 c=0;
%o A136480 while (m%2==0) {m/=2;c++;}
%o A136480 document.write(c+", ");
%o A136480 }  // _Jon Perry_, Sep 12 2014
%o A136480 (Python)
%o A136480 def A136480(n): return (~(m:=n+(n&1))& m-1).bit_length() # _Chai Wah Wu_, Jul 08 2022
%Y A136480 Cf. A007814, A050603, A094267, A163575, A001511, A039963 (parity).
%K A136480 nonn,base,easy
%O A136480 0,4
%A A136480 _Reinhard Zumkeller_, Dec 31 2007