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.

A367356 Length of base-3 Commas sequence when started at n.

Original entry on oeis.org

17, 5, 2, 1, 16, 164, 490, 163, 4, 3, 489, 15, 14, 2, 162, 161, 13, 1472, 488, 1471, 160, 1, 159, 487, 12, 486, 1470, 1469, 11, 158, 157, 1468, 485, 484, 156, 10, 9, 483, 1467, 1466, 8, 155, 154, 1465, 482, 481, 153, 7, 6, 480, 1464, 1463, 5, 41, 152, 40, 1462, 479, 1461, 151, 4, 150, 478, 39, 477, 3, 1460, 2, 38, 149, 37, 1459, 476, 1458, 148, 1, 147, 475, 36, 474, 1457, 1456, 35, 146, 145, 1455, 473, 472, 144, 34, 33, 471, 1454, 1453, 32, 143, 142, 1452, 470, 469
Offset: 1

Views

Author

N. J. A. Sloane, Nov 18 2023

Keywords

Comments

a(n) = 1 for n = 4, 22, 76, ... (the numbers 222...2211 in ternary)
We now know that a(n) is finite for all n.

Examples

			For a(1) = 17, see A367355, which has 17 terms.
		

Crossrefs

Programs

  • Python
    from itertools import islice
    from sympy.ntheory.factor_ import digits
    def a(n, b=3): # generator of terms
        an, y, c = n, 1, 0
        while y < b:
            an, y, c = an + b*(an%b), 1, c+1
            while y < b:
                if str(digits(an+y, b)[1]) == str(y):
                    an += y
                    break
                y += 1
        return c
    print([a(n) for n in range(1, 101)]) # Michael S. Branicky, Nov 18 2023