%I #64 Aug 30 2024 06:24:52
%S 2,4,2,3,2,6,2,3,2,4,2,3,2,5,2,3,2,4,2,3,2,8,2,3,2,4,2,3,2,5,2,3,2,4,
%T 2,3,2,6,2,3,2,4,2,3,2,5,2,3,2,4,2,3,2,7,2,3,2,4,2,3,2,5,2,3,2,4,2,3,
%U 2,6,2,3,2,4,2,3,2,5,2,3,2,4,2,3,2,10,2,3,2,4,2,3,2,5,2,3,2,4,2,3,2,6,2,3,2,4
%N Exponent of p=2 in 12n+4 = 3(4n+1)+1.
%C In the Collatz trajectory of m=4n+1, the first 3x+1 step is followed by a(n) consecutive divide-by-2 steps.
%C Large shifted overlaps with A085058.
%H Antti Karttunen, <a href="/A087229/b087229.txt">Table of n, a(n) for n = 0..21845</a>
%H Antti Karttunen, <a href="/A087229/a087229.txt">Data supplement: n, a(n) computed for n = 1..65537</a>
%F a(n) = A007814(A017569(n)). - _Antti Karttunen_, Oct 09 2018
%F Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = 3. - _Amiram Eldar_, Aug 30 2024
%e n=85: m = 4*n + 1 = 4*85 + 1 = 341, whose Collatz trajectory begins with 341 -> 1024 followed by a(85)=10 consecutive halving steps.
%t Table[Part[Part[FactorInteger[12*w+4],1],2], {w,0,100}]
%t Table[IntegerExponent[12*n + 4, 2], {n, 0, 100}] (* _Amiram Eldar_, Feb 03 2022 *)
%o (PARI) A087229(n) = valuation((12*n)+4,2); \\ _Antti Karttunen_, Oct 09 2018
%o (Perl) # In 4*n+1 (n>0), find position of first bit that will repeat.
%o sub a {
%o my $nv= ((shift() << 2) | 1);
%o my $bp= 1;
%o while (($nv & 1) xor ($nv & 2)) {
%o $nv>>= 1;
%o $bp++;
%o }
%o return $bp;
%o }
%o # _Ruud H.G. van Tol_, Sep 27 2021
%Y Cf. A007814, A085058, A017569.
%K nonn
%O 0,1
%A _Labos Elemer_, Aug 28 2003
%E Part of the name moved to comments section by _Antti Karttunen_, Oct 09 2018
%E a(0) = 2 prepended by _Ihar Senkevich_, Feb 05 2022