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.

A330129 a(n) is the last term of the analogous sequence to A121805, but with initial term n, or -1 if that sequence is infinite.

This page as a plain text file.
%I A330129 #31 Feb 07 2024 13:21:43
%S A330129 99999945,9999999999999918,36,9999945,999945,9999999999999999936,936,
%T A330129 9999999999972,999999936,999936,999936,99999945,999954,999918,72,
%U A330129 99999918,999999999927,18,999981,999999999999999963,99981,999999999999999963,999936,9999999999999918,9963
%N A330129 a(n) is the last term of the analogous sequence to A121805, but with initial term n, or -1 if that sequence is infinite.
%C A330129 The numbers of terms of the corresponding sequences are in A330128.
%H A330129 Michael S. Branicky, <a href="/A330129/b330129.txt">Table of n, a(n) for n = 1..10000</a>
%H A330129 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>, <a href="https://www.youtube.com/watch?v=_EHAdf6izPI">Youtube</a>
%t A330129 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]]]; oX]; Array[a, 30]
%o A330129 (Python)
%o A330129 def nxt(x):
%o A330129     p, n = 1, x
%o A330129     while n >= 10:
%o A330129         n //= 10
%o A330129         p *= 10
%o A330129     return p * (n + 1)
%o A330129 def a(n):
%o A330129     nT, nX, w1, w2, w3, stp  = 1, n, 0, 0, 0, 100
%o A330129     while True:
%o A330129         oX = nX
%o A330129         nT += 1
%o A330129         x = 10*(oX%10)
%o A330129         nX = next((y for y in range(1, 10) if str(oX+x+y)[0] == str(y)), 0)
%o A330129         if nX == 0: break
%o A330129         else: nX += oX + x
%o A330129         if nT == stp:
%o A330129             stp += 100
%o A330129             w1, w2, w3 = w2, w3, nX
%o A330129             if w3 + w1 == 2*w2 and (w3 - w2)%100 == 0:
%o A330129                 it = (nxt(nX) - nX - 1)//(w3 - w2)
%o A330129                 nT += it*100
%o A330129                 nX += (w3 - w2)*it
%o A330129                 w3 = nX
%o A330129                 stp += it*100
%o A330129     return oX
%o A330129 print([a(n) for n in range(1, 30)]) # _Michael S. Branicky_, Nov 18 2023 after _Giovanni Resta_
%Y A330129 Cf. A330128, A121805, A139284, A366492.
%K A330129 nonn,base
%O A330129 1,1
%A A330129 _Giovanni Resta_, Dec 02 2019
%E A330129 Escape clause added to definition by _N. J. A. Sloane_, Nov 14 2023