%I #55 Nov 04 2024 01:33:38
%S 0,5,11,13,17,26,35,44,53,62,71,79,97,105,111,113,117,125,131,133,137,
%T 145,151,153,157,165,171,173,177,185,191,193,197,206,214,220,222,226,
%U 234,240,242,246,254,260,262,266,274,280,282,286,294,301
%N Sum of two digits touching a comma = difference between the two terms separated by that comma; start with a(0)=0, a(1)=5. If there is a choice, choose the smaller value for a(n).
%C Comment from Jack Brennen: This sequence stops after 123 terms. The 123rd term is 989 which has no possible successor. It looks like many low starting points lead to 989 and halt there. The smallest starting point which goes beyond that seems to be the number 396 (which has no possible predecessor). The sequence beginning with 396 goes on for quite some distance. I traced it up to values in excess of 20 million (over 3 million terms).
%C Comment from Lars Blomberg: (Start)
%C 1. As for 396, I notice that the first differences of the sequence are: 396,10,10,10,10,10,10,10,10,10,10,11,12,14,8,6,12,14,8,6,12,15, 10,10,10,10,10,10,10,10,11,12,14,8,16,12,14,8,17,14,8,16,12,14, 8,16,13,16,12,14,18,16,12,(6,2,4,8) ... repeated indefinitely, which suggests that the sequence started with 396 is infinite.
%C 2. Numbers with no successors, empirically for number of digits n=2,3,4:
%C 86 986 9986
%C 87 987 9987
%C 88 988 9988
%C 89 989 9989
%C 91 991 9991
%C 92 992 9992
%C 93 993 9993
%C 94 994 9994
%C It seems that the rule is that numbers of the form 10^n - s, s=14, 13, 12, 11, 9, 8, 7, 6 have no successors. Can this be proved? It suggests that once an iteration has come into the millions, the chance of hitting a no-successor becomes very small. (End)
%C Comment from Nicolas Graner (Start):
%C Here is an argument to try to prove that the sequence starting with 396 is infinite.
%C Starting from 1001 (which is reached from 396), you eventually reach 9995. The next number is 10001, which eventually yields 99995, followed by 100001.
%C More generally, take 1x001, where x is any sequence of digits. It will reproduce the sequence from 1001 to 1995, up to 1x995. This is followed by 1y001, with y = X+1. This repeats until x becomes all 9's, at which point the first digit will change: 199..995 -> 200..002.
%C Now we get numbers of the form 2x002, which reproduce the sequence from 2002 to 2994 while x increases, until it reaches all 9's and the first digit becomes 3.
%C You can repeat this reasoning with each value of the first digit. There are some subtleties because, when the first digit changes, the last one is not always the same. But since the sequence is very "robust" (as evidenced by forking sequences, which reunite pretty quickly), variations in the last digit have no effect beyond a couple of terms.
%C So starting with 100*001, we are bound to get eventually to 999*995, which is followed with 1000*001 (with one more digit). Which shows that the sequence is almost certainly infinite. (End)
%C See A230450 for the (probably) infinite sequence starting with 396. See A230452 for the numbers not ending in 989 (as does the present sequence). See A230453 for the number of terms in the comma sum sequence depending on the starting value. - _M. F. Hasler_, Oct 19 2013
%D Eric Angelini and others, Postings to Sequence Fans Mailing List, Oct 11 2011.
%H M. F. Hasler, <a href="/A230288/b230288.txt">Table of n, a(n) for n = 0..122</a>
%H Eric Angelini, <a href="http://www.cetteadressecomportecinquantesignes.com/CommaSum.htm">Comma Sums</a>
%H Eric Angelini, <a href="/A230288/a230288.txt">Comma Sums</a> [Cached copy, with permission]
%F a(n+1) - a(n) = lsd(a(n)) + msd(a(n+1)), where
%F lsd(a) = "a mod 10" is the least significant (leftmost), and msd(a) = floor(a/10^floor(log[10](a))) the most significant (rightmost) digit. - _M. F. Hasler_, Oct 19 2013
%e Consider the first comma: Its closest digits are 0 and 5. Add 0 to 5: The sum (5) is the difference between 0 and 5.
%e Consider the second comma: Its closest digits are 5 and 1. Add 5 to 1: The sum (6) is the difference between 5 and 11.
%e Etc.
%o (PARI) print_A230288(s=5,nMax=9e9,verbose=1)={print1(s);for(i=1,nMax, for(d=1,18,digits(s+d)[1]+s%10==d&&print1(","s+=d)+next(2));verbose && print("\nSequence stops after the term a("i")="s);return([i,s]))} \\ Starting with 0 yields the 2-term sequence (0,1); start with 5 to get the sequence 0,5,... without the initial zero, _M. F. Hasler_, Oct 19 2013
%o (PARI) A230288_vec(a=[0,5],nMax=9e9)={ for(i=1,nMax, for(d=1,18, d==a[#a]%10+digits(a[#a]+d)[1] && (a=concat(a,a[#a]+d)) && next(2)); break);a} \\ _M. F. Hasler_, Oct 19 2013
%o (Python)
%o from itertools import count, islice
%o def A230288gen(start=[0, 5]): # generator of terms
%o yield from start
%o an = start[-1]
%o for n in count(len(start)+1):
%o lsd = an%10; b = an+lsd
%o an = next((k for k in range(b+1, b+20) if k==b+int(str(k)[0])), 0)
%o if not an: return
%o yield an
%o print(list(islice(A230288gen(), 123))) # _Michael S. Branicky_, Nov 03 2024
%Y Cf. A230450, A230452, A230453.
%K nonn,fini,full,base
%O 0,2
%A _N. J. A. Sloane_, Oct 17 2013
%E More terms (full sequence) and minor edits from _M. F. Hasler_, Oct 19 2013