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.

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.

This page as a plain text file.
%I A368940 #18 Jan 12 2024 22:06:28
%S A368940 1,86,338,816,2031,1570,2637,2392,4790,3,2,15199,21136,8124,12360,
%T A368940 18210,101998,41798,15250,135,40063,27298,176470,6553,15757,5031,
%U A368940 187645,24050,567055,487,141008,71243,341907,154758,38175,150429,84011,106833,351884,1117,391266,324631,1287699,374743
%N 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.
%C A368940 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.
%H A368940 Michael S. Branicky, <a href="/A368940/b368940.txt">Table of n, a(n) for n = 1..220</a> (terms 1..140 from Scott R. Shannon)
%H A368940 Eric Angelini, <a href="https://cinquantesignes.blogspot.com/2024/01/replace-my-twins-triplets-etc-by-1.html">Replace my twins, triplets, etc. by 1</a>, personal blog CinquanteSignes.blogspot.com, Jan. 5, 2024.
%e A368940 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.
%e A368940 a(10) = 3 as the iterations are : 1 -> 10 -> 100 -> 10, taking three steps to reach a repeated value.
%e A368940 a(11) = 2 as the iterations are : 1 -> 11 -> 1, taking two steps to reach a repeated value.
%o A368940 (Python)
%o A368940 from itertools import groupby
%o A368940 def a(n):
%o A368940     seen, k, c = set(), 1, 0
%o A368940     while k not in seen:
%o A368940         seen.add(k)
%o A368940         c += 1
%o A368940         s = str(k)
%o A368940         t = "".join(k for k, g in groupby(s))
%o A368940         k = k*n if s == t else int(t)
%o A368940     return c
%o A368940 print([a(n) for n in range(1, 45)]) # _Michael S. Branicky_, Jan 11 2024
%Y A368940 Cf. A171901, A351328, A330674, A316650, A098282, A330634, A329624.
%K A368940 nonn,base
%O A368940 1,2
%A A368940 _Scott R. Shannon_ and _Eric Angelini_, Jan 10 2024