A087230 a(n) is the 2-adic valuation of 6*n + 4.
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, 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, 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
Offset: 0
Examples
n=85: m = 6*85+4 = 514 and Collatz-iteration goes on by one dividing step, a(85)=1.
Links
- Kenny Lau, Table of n, a(n) for n = 0..10000
Programs
-
Maple
a:= n-> padic[ordp](6*n+4, 2): seq(a(n), n=0..120); # Alois P. Heinz, Mar 16 2021
-
Mathematica
Table[Part[Part[FactorInteger[6*w+4], 1], 2], {w, 0, 100}] Table[IntegerExponent[6*n + 4, 2], {n, 0, 100}] (* Amiram Eldar, Jan 27 2022 *)
-
PARI
forstep(n=0, 1000, 1, m=6*n+4; print1(valuation(m, 2), ", ") ) \\ K. G. Stier, Aug 19 2014
-
Perl
sub a { my $nv= ((shift() << 1) | 1); my $bp= 1; while (($nv & 1) xor ($nv & 2)) { $nv>>= 1; $bp++; } return $bp; } # Ruud H.G. van Tol, Nov 16 2021
-
Python
n=100; N=3*n+2; val=[1]*(N+1); exp=2 while exp <= N: for j in range(exp,N+1,exp): val[j] += 1 exp *= 2 for i in range(n+1): print(i,val[3*i+2]) # Kenny Lau, Jun 09 2018
-
Python
def A087230(n): return (~(m:=6*n+4) & m-1).bit_length() # Chai Wah Wu, Jul 02 2022
Formula
Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = 2. - Amiram Eldar, Sep 10 2024
Extensions
a(0) = 2 prepended by Andrey Zabolotskiy, Jan 27 2022, based on Ihar Senkevich's contribution
Comments