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.

Showing 1-2 of 2 results.

A340873 a(n) is the number of iterations of A245471 needed to reach 1 starting from n.

Original entry on oeis.org

0, 1, 3, 2, 6, 4, 4, 3, 11, 7, 7, 5, 9, 5, 5, 4, 12, 12, 12, 8, 8, 8, 8, 6, 10, 10, 10, 6, 14, 6, 6, 5, 21, 13, 13, 13, 13, 13, 13, 9, 17, 9, 9, 9, 17, 9, 9, 7, 19, 11, 11, 11, 11, 11, 11, 7, 15, 15, 15, 7, 15, 7, 7, 6, 22, 22, 22, 14, 14, 14, 14, 14, 22, 14
Offset: 1

Views

Author

Rémy Sigrist, Jan 31 2021

Keywords

Comments

This sequence is well defined.
Sketch of proof:
- we focus on odd numbers n > 1,
- if the binary representation of n ends with k 0's and one 1:
in two steps we obtain a number with the same binary length as n
and ending with k-1 0's and one 1,
iterating again will eventually give a number ending with two or more 1's,
- if the binary representation of n ends with k 1's (k > 1):
in k+1 steps we obtain a number with a binary length strictly smaller
than that of n,
- so any odd number > 1 will eventually reach the number 1.

Examples

			For n = 10:
- the trajectory of 10 is 10 -> 5 -> 14 -> 7 -> 8 -> 4 -> 2 -> 1,
- so a(10) = 7.
		

Crossrefs

Programs

  • PARI
    a(n) = for (k=0, oo, if (n==1, return (k), n%2, n=bitxor(n, 2*n+1), n=n/2))

Formula

a(2*n) = a(n) + 1.

A341231 Irregular triangle read by rows giving trajectory from n to reach 1 under the map A245471.

Original entry on oeis.org

1, 2, 1, 3, 4, 2, 1, 4, 2, 1, 5, 14, 7, 8, 4, 2, 1, 6, 3, 4, 2, 1, 7, 8, 4, 2, 1, 8, 4, 2, 1, 9, 26, 13, 22, 11, 28, 14, 7, 8, 4, 2, 1, 10, 5, 14, 7, 8, 4, 2, 1, 11, 28, 14, 7, 8, 4, 2, 1, 12, 6, 3, 4, 2, 1, 13, 22, 11, 28, 14, 7, 8, 4, 2, 1, 14, 7, 8, 4, 2, 1
Offset: 1

Views

Author

Rémy Sigrist, Feb 07 2021

Keywords

Comments

A340873 gives row lengths.
A341235 gives greatest terms.

Examples

			Table begins:
    1;
    2, 1;
    3, 4, 2, 1;
    4, 2, 1;
    5, 14, 7, 8, 4, 2, 1;
    6, 3, 4, 2, 1;
    7, 8, 4, 2, 1;
    8, 4, 2, 1;
    9, 26, 13, 22, 11, 28, 14, 7, 8, 4, 2, 1;
    10, 5, 14, 7, 8, 4, 2, 1;
    11, 28, 14, 7, 8, 4, 2, 1;
    12, 6, 3, 4, 2, 1;
    13, 22, 11, 28, 14, 7, 8, 4, 2, 1;
    14, 7, 8, 4, 2, 1;
    15, 16, 8, 4, 2, 1;
    16, 8, 4, 2, 1;
    ...
		

Crossrefs

Programs

  • PARI
    row(n) = { my (r=[n]); while (n>1, r=concat(r, n=if (n%2, bitxor(n, 2*n+1), n/2))); r }

Formula

T(n, 1) = n.
T(n, A340873(n)) = 1.
Showing 1-2 of 2 results.