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.

A354236 A(n,k) is the n-th number m such that the Collatz (or 3x+1) trajectory starting at m contains exactly k odd integers; square array A(n,k), n>=1, k>=1, read by antidiagonals.

Original entry on oeis.org

1, 5, 2, 3, 10, 4, 17, 6, 20, 8, 11, 34, 12, 21, 16, 7, 22, 35, 13, 40, 32, 9, 14, 23, 68, 24, 42, 64, 25, 18, 15, 44, 69, 26, 80, 128, 33, 49, 19, 28, 45, 70, 48, 84, 256, 43, 65, 50, 36, 29, 46, 75, 52, 85, 512, 57, 86, 66, 51, 37, 30, 88, 136, 53, 160, 1024
Offset: 1

Views

Author

Alois P. Heinz, May 20 2022

Keywords

Examples

			Square array A(n,k) begins:
    1,   5,  3,  17, 11,  7,  9,  25,  33,  43, ...
    2,  10,  6,  34, 22, 14, 18,  49,  65,  86, ...
    4,  20, 12,  35, 23, 15, 19,  50,  66,  87, ...
    8,  21, 13,  68, 44, 28, 36,  51,  67,  89, ...
   16,  40, 24,  69, 45, 29, 37,  98, 130, 172, ...
   32,  42, 26,  70, 46, 30, 38,  99, 131, 173, ...
   64,  80, 48,  75, 88, 56, 72, 100, 132, 174, ...
  128,  84, 52, 136, 90, 58, 74, 101, 133, 177, ...
  256,  85, 53, 138, 92, 60, 76, 102, 134, 178, ...
  512, 160, 96, 140, 93, 61, 77, 196, 260, 179, ...
		

Crossrefs

Row n=1 gives A092893(k-1).
Main diagonal gives A380244.

Programs

  • Maple
    b:= proc(n) option remember; irem(n, 2, 'r')+
          `if`(n=1, 0, b(`if`(n::odd, 3*n+1, r)))
        end:
    A:= proc() local h, p, q; p, q:= proc() [] end, 0;
          proc(n, k)
            if k=1 then return 2^(n-1) fi;
            while nops(p(k))
    				
  • Mathematica
    b[n_] := b[n] = Module[{q, r}, {q, r} = QuotientRemainder[n, 2]; r +
         If[n == 1, 0, b[If[OddQ[n], 3*n + 1, q]]]];
    A = Module[{h, p, q}, p[_] = {}; q = 0;
         Function[{n, k}, If[k == 1, 2^(n - 1)];
         While[Length[p[k]] < n, q = q + 1;
            h = b[q];
            p[h] = Append[p[h], q]];
         p[k][[n]]]];
    Table[Table[A[n, 1+d-n], {n, 1, d}], {d, 1, 12}] // Flatten (* Jean-François Alcover, Jun 02 2022, after Alois P. Heinz *)

Formula

A078719(A(n,k)) = k.