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.
%I A087230 #116 Jan 06 2025 01:25:21 %S A087230 2,1,4,1,2,1,3,1,2,1,6,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1,5,1,2,1,3,1,2,1, %T A087230 4,1,2,1,3,1,2,1,8,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1,5,1,2,1,3,1,2,1,4,1, %U A087230 2,1,3,1,2,1,6,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1,5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 %N A087230 a(n) is the 2-adic valuation of 6*n + 4. %C A087230 In Collatz-algorithm if initiated with m=odd value, the first 3x+1 step is followed by a(n) step corresponding to division by 2. Compare to A085058 and A087229. Each 2nd term is either =1 or equals corresponding term of A087229, depending on whether the odd number congruent to 1 or 3 modulo 4. %C A087230 From _K. G. Stier_, Aug 19 2014: (Start) %C A087230 Sequence exhibits a "pseudo" ruler function (A001511) behavior. It is similar to the latter in repeating equal terms m>0 after each 2^m steps. However, the first occurrence of m in the mentioned ruler function is simply at n=log_2(m), while in the given sequence this property develops two distinct (odd and even) strands: %C A087230 First occurrence of %C A087230 m=1 at a(1); m=2 at a(0) %C A087230 m=3 at a(6); m=4 at a(2) %C A087230 m=5 at a(26); m=6 at a(10) %C A087230 m=7 at a(106); m=8 at a(42) %C A087230 m=9 at a(426); m=10 at a(170) %C A087230 ... %C A087230 where values n in the odd strand (1,6,26,106,426,...) equal sequence A020989, and values n in the even strand (0,2,10,42,170,...) equal sequence A020988. (End) %H A087230 Kenny Lau, <a href="/A087230/b087230.txt">Table of n, a(n) for n = 0..10000</a> %F A087230 a(n) = A007814(A016957(n)). - _Michel Marcus_, Jan 27 2022 %F A087230 Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = 2. - _Amiram Eldar_, Sep 10 2024 %e A087230 n=85: m = 6*85+4 = 514 and Collatz-iteration goes on by one dividing step, a(85)=1. %p A087230 a:= n-> padic[ordp](6*n+4, 2): %p A087230 seq(a(n), n=0..120); # _Alois P. Heinz_, Mar 16 2021 %t A087230 Table[Part[Part[FactorInteger[6*w+4], 1], 2], {w, 0, 100}] %t A087230 Table[IntegerExponent[6*n + 4, 2], {n, 0, 100}] (* _Amiram Eldar_, Jan 27 2022 *) %o A087230 (PARI) forstep(n=0, 1000, 1, m=6*n+4; print1(valuation(m, 2), ", ") ) \\ _K. G. Stier_, Aug 19 2014 %o A087230 (Python) %o A087230 n=100; N=3*n+2; val=[1]*(N+1); exp=2 %o A087230 while exp <= N: %o A087230 for j in range(exp,N+1,exp): val[j] += 1 %o A087230 exp *= 2 %o A087230 for i in range(n+1): print(i,val[3*i+2]) %o A087230 # _Kenny Lau_, Jun 09 2018 %o A087230 (Python) %o A087230 def A087230(n): return (~(m:=6*n+4) & m-1).bit_length() # _Chai Wah Wu_, Jul 02 2022 %o A087230 (Perl) %o A087230 sub a { %o A087230 my $nv= ((shift() << 1) | 1); %o A087230 my $bp= 1; %o A087230 while (($nv & 1) xor ($nv & 2)) { %o A087230 $nv>>= 1; %o A087230 $bp++; %o A087230 } %o A087230 return $bp; %o A087230 } # _Ruud H.G. van Tol_, Nov 16 2021 %Y A087230 Cf. A007814, A016957, A085058, A087229, A020988, A020989, A061547. %K A087230 nonn,easy %O A087230 0,1 %A A087230 _Labos Elemer_, Aug 28 2003 %E A087230 a(0) = 2 prepended by _Andrey Zabolotskiy_, Jan 27 2022, based on _Ihar Senkevich_'s contribution