Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #36 Jan 09 2025 12:25:27
%S 2137453,194697747222394,2,199900,19706,209534289952018960,15,
%T 198104936410,19511030,20573,20572,2137452,20534,19238,2,2089707,
%U 20670629294,1,21482,19278442756937613,2074,19278442756937612,20571,194697747222393,193,197062,1,197,2061823
%N a(n) is the number of terms in the analog of A121805 but starting with n, or -1 if that sequence is infinite.
%C The final terms of the corresponding sequences are given in A330129.
%H Michael S. Branicky, <a href="/A330128/b330128.txt">Table of n, a(n) for n = 1..10000</a>
%H Eric Angelini, Michael S. Branicky, Giovanni Resta, N. J. A. Sloane, and David W. Wilson, The Comma Sequence: A Simple Sequence With Bizarre Properties, <a href="http://arxiv.org/abs/2401.14346">arXiv:2401.14346</a>, Fibonacci Quarterly 62:3 (2024), 215-232.
%H Eric Angelini, Michael S. Branicky, Giovanni Resta, N. J. A. Sloane, and David W. Wilson, <a href="/A121805/a121805_1.pdf">The Comma Sequence: A Simple Sequence With Bizarre Properties</a>, Local copy.
%H N. J. A. Sloane, <a href="https://www.youtube.com/watch?v=_EHAdf6izPI">Eric Angelini's Comma Sequence</a>, Experimental Math Seminar, Rutgers Univ., January 18, 2024, Youtube video; <a href="https://sites.math.rutgers.edu/~zeilberg/expmath/sloane2024.pdf">Slides</a>
%t nxt[x_] := Block[{p=1, n=x}, While[n >= 10, n = Floor[n/10]; p *= 10]; p (n + 1)]; a[n_] := Block[{nT=1, nX=n, w1, w2, w3, x, it, stp, oX}, stp = 100; w1 = w2 = w3 = 0; While[True, oX = nX; nT++; x = 10*Mod[oX, 10]; nX = SelectFirst[Range[9], IntegerDigits[oX + x + #][[1]] == # &, 0]; If[nX == 0, Break[], nX = nX + oX + x]; If[nT == stp, stp += 100; w1=w2; w2=w3; w3=nX; If[w3 + w1 == 2 w2 && Mod[w3 - w2, 100] == 0, it = Floor[(nxt[nX] - nX - 1)/(w3 - w2)]; nT += it*100; nX += (w3 - w2)*it; w3=nX; stp += it*100]]]; nT - 1]; Array[a, 30]
%o (Python)
%o def nxt(x):
%o p, n = 1, x
%o while n >= 10:
%o n //= 10
%o p *= 10
%o return p * (n + 1)
%o def a(n):
%o nT, nX, w1, w2, w3, stp = 1, n, 0, 0, 0, 100
%o while True:
%o oX = nX
%o nT += 1
%o x = 10*(oX%10)
%o nX = next((y for y in range(1, 10) if str(oX+x+y)[0] == str(y)), 0)
%o if nX == 0: break
%o else: nX += oX + x
%o if nT == stp:
%o stp += 100
%o w1, w2, w3 = w2, w3, nX
%o if w3 + w1 == 2*w2 and (w3 - w2)%100 == 0:
%o it = (nxt(nX) - nX - 1)//(w3 - w2)
%o nT += it*100
%o nX += (w3 - w2)*it
%o w3 = nX
%o stp += it*100
%o return nT - 1
%o print([a(n) for n in range(1, 30)]) # _Michael S. Branicky_, Nov 18 2023 after _Giovanni Resta_
%Y Cf. A330129 (corresponding last term), A121805, A139284, A366492.
%Y For record high points see A367364 and A367365.
%K nonn,base
%O 1,1
%A _Giovanni Resta_, Dec 02 2019
%E Escape clause added to definition by _N. J. A. Sloane_, Nov 14 2023