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.

A123390 Triangle read by rows: n-th row starts with n and continues with half the previous value as long as that is even.

Original entry on oeis.org

1, 2, 1, 3, 4, 2, 1, 5, 6, 3, 7, 8, 4, 2, 1, 9, 10, 5, 11, 12, 6, 3, 13, 14, 7, 15, 16, 8, 4, 2, 1, 17, 18, 9, 19, 20, 10, 5, 21, 22, 11, 23, 24, 12, 6, 3, 25, 26, 13, 27, 28, 14, 7, 29, 30, 15, 31, 32, 16, 8, 4, 2, 1, 33, 34, 17, 35, 36, 18, 9, 37, 38, 19, 39, 40, 20, 10, 5, 41, 42, 21
Offset: 1

Views

Author

Keywords

Comments

A fractal sequence, generated by the rule a(n) is a new maximum when a(n-1) is odd and a repetition of an earlier value when a(n-1) is even.
From Flávio V. Fernandes, Mar 13 2025: (Start)
a(n) is given by A003602(n) at A001511(n) diagram
1 . 2 . 3 . 4 . 5 . 6 . 7 . 8 . 9
. 1 . . . 2 . . . 3 . . . 4 . . .
. . . 1 . . . . . . . 2 . . . . .
. . . . . . . 1 . . . . . . . . .
. . . . . . . . . . . . . . . 1 .
read by backwards 2^n, which is given by A118319(n) at A001511(n) diagram
1 . 2 . 4 . 5 . 8 . 9 .11 .12 .16
. 3 . . . 6 . . .10 . . .13 . . .
. . . 7 . . . . . . .14 . . . . .
. . . . . . .15 . . . . . . . . .
. . . . . . . . . . . . . . .31 . - see formula. (End)

Examples

			Triangle starts
  1;
  2, 1;
  3;
  4, 2, 1;
  5;
  6, 3;
  7;
  8, 4, 2, 1;
  9;
  10, 5;
  11;
  12, 6, 3;
  13;
		

Crossrefs

Row lengths are A001511.
Row sums give A129527.
Cf. A120385.

Programs

  • Maple
    T:= proc(n) local m,l; m:=n; l:= m;
          while irem(m, 2, 'm')=0 do l:=l,m od: l
        end:
    seq(T(n), n=1..40);  # Alois P. Heinz, Oct 09 2015
  • Mathematica
    Flatten[Function[n, NestWhile[Append[#, Last[#]/2] &, {n}, EvenQ[Last[#]] &]][#] & /@ Range[20]] (* Birkas Gyorgy, Apr 13 2011 *)

Formula

a(1) = 1, for n > 1, if a(n-1) is even, a(n) = a(n-1)/2, otherwise a(n) = (max_{k
Ordinal transform of A082850.
a(n) = A003602(A108918(n)). - Flávio V. Fernandes, Mar 13 2025