A347653 Partial sums of the trajectory of all positive integers in the 3x+1 or Collatz problem, including the trajectory [1, 4, 2, 1] of 1.
1, 5, 7, 8, 10, 11, 14, 24, 29, 45, 53, 57, 59, 60, 64, 66, 67, 72, 88, 96, 100, 102, 103, 109, 112, 122, 127, 143, 151, 155, 157, 158, 165, 187, 198, 232, 249, 301, 327, 340, 380, 400, 410, 415, 431, 439, 443, 445, 446, 454, 458, 460, 461, 470, 498, 512, 519, 541, 552, 586
Offset: 1
Examples
The first two rows of A235795 are [1, 4, 2, 1]; [2, 1], so a(1)..a(6) are [1, 5, 7, 8, 10, 11].
Links
Programs
-
Mathematica
A235795row[n_]:=If[n==1,{1,4,2,1},NestWhileList[If[OddQ[#],3#+1,#/2]&,n,#>1&]]; nrows=10;Accumulate[Flatten[Array[A235795row,nrows]]] (* Paolo Xausa, Jun 20 2022 *)
-
PARI
f(n) = if (n%2, 3*n+1, n/2); \\ A014682 row(n) = {my(list=List()); listput(list, n); until(n==1, n = f(n); listput(list, n)); Vec(list);} \\ A235795 lista(nn) = {my(s=0, list = List()); for (n=1, nn, my(v = row(n)); for (k=1, #v, s += v[k]; listput(list, s););); Vec(list);} \\ Michel Marcus, Sep 10 2021