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-1 of 1 results.

A368940 Number of iterations before a repeated value, or -1 if this never occurs, when starting at k = 1 and repeating k = k*n if k does not contain any adjacent equal digits, else k = k with all adjacent equal digits replaced by a single copy of the same digit.

Original entry on oeis.org

1, 86, 338, 816, 2031, 1570, 2637, 2392, 4790, 3, 2, 15199, 21136, 8124, 12360, 18210, 101998, 41798, 15250, 135, 40063, 27298, 176470, 6553, 15757, 5031, 187645, 24050, 567055, 487, 141008, 71243, 341907, 154758, 38175, 150429, 84011, 106833, 351884, 1117, 391266, 324631, 1287699, 374743
Offset: 1

Views

Author

Scott R. Shannon and Eric Angelini, Jan 10 2024

Keywords

Comments

The largest term in the first 140 terms is a(127) = 121311726, which reaches a maximum value of 133672219006681613318653118648140533992241 at the 17276871st iteration, before repeating 2102014745703.

Examples

			a(2) = 86 as the iterations are : 1 -> 2 -> 4 -> 8 -> 16 -> 32 -> 64 -> 128 -> 256 -> 512 -> 1024 -> 2048 -> 4096 -> 8192 -> 16384 -> 32768 -> 65536 -> 6536 -> 13072 -> 26144 -> 2614 -> 5228 -> 528 -> 1056 -> 2112 -> 212 -> 424 -> 848 -> 1696 -> 3392 -> 392 -> 784 -> 1568 -> 3136 -> 6272 -> 12544 -> 1254 -> 2508 -> 5016 -> 10032 -> 1032 -> 2064 -> 4128 -> 8256 -> 16512 -> 33024 -> 3024 -> 6048 -> 12096 -> 24192 -> 48384 -> 96768 -> 193536 -> 387072 -> 774144 -> 7414 -> 14828 -> 29656 -> 59312 -> 118624 -> 18624 -> 37248 -> 74496 -> 7496 -> 14992 -> 1492 -> 2984 -> 5968 -> 11936 -> 1936 -> 3872 -> 7744 -> 74 -> 148 -> 296 -> 592 -> 1184 -> 184 -> 368 -> 736 -> 1472 -> 2944 -> 294 -> 588 -> 58 -> 116 -> 16, taking 86 steps to reach a repeated value.
a(10) = 3 as the iterations are : 1 -> 10 -> 100 -> 10, taking three steps to reach a repeated value.
a(11) = 2 as the iterations are : 1 -> 11 -> 1, taking two steps to reach a repeated value.
		

Crossrefs

Programs

  • Python
    from itertools import groupby
    def a(n):
        seen, k, c = set(), 1, 0
        while k not in seen:
            seen.add(k)
            c += 1
            s = str(k)
            t = "".join(k for k, g in groupby(s))
            k = k*n if s == t else int(t)
        return c
    print([a(n) for n in range(1, 45)]) # Michael S. Branicky, Jan 11 2024
Showing 1-1 of 1 results.