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.
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
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.
Links
- Michael S. Branicky, Table of n, a(n) for n = 1..220 (terms 1..140 from Scott R. Shannon)
- Eric Angelini, Replace my twins, triplets, etc. by 1, personal blog CinquanteSignes.blogspot.com, Jan. 5, 2024.
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
Comments