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.

A375477 Lexicographically earliest sequence of distinct nonnegative terms arranged in successive chunks whose digitsum = 10, said chunks being "linked" (see the Comments section for an explanation).

This page as a plain text file.
%I A375477 #13 Aug 17 2024 22:41:19
%S A375477 0,1,2,3,4,40,6,60,10,12,20,5,21,11,8,80,101,13,15,50,14,41,23,30,7,
%T A375477 70,100,1001,16,102,22,24,42,31,17,10001,19,91,103,33,32,104,43,111,
%U A375477 105,110,100001,106,201,107,1000001,109,901,112,51,113,120,10000001,114,121
%N A375477 Lexicographically earliest sequence of distinct nonnegative terms arranged in successive chunks whose digitsum = 10, said chunks being "linked" (see the Comments section for an explanation).
%C A375477 The 1st chunk with digitsum = 10 is (0, 1, 2, 3, 4), ending with a "4". The next chunk with digitsum = 10 must start with a "4" (this is the "link") and is thus (40, 6). As the next chunk with digitsum = 10 must start with a "6", we have (60, 10, 12). The next chunk with digitsum = 10 must start with a "2" and we have (20, 5, 21), etc.
%C A375477 No chunk is allowed to end with a zero.  Thus, no intermediate chunk digit sum can be 9, and anytime a chunk needs a digitsum of 2 to "complete", the next term must be of the form 10^k + 1 for k >= 1.
%C A375477 Infinite since there are an infinity of terms with digits sums <= 10.
%C A375477 a(5367) has 1001 digits.
%H A375477 Michael S. Branicky, <a href="/A375477/b375477.txt">Table of n, a(n) for n = 1..5366</a>
%H A375477 Eric Angelini, <a href="https://cinquantesignes.blogspot.com/2024/08/tile-my-sequence.html">Tile my sequence</a>, personal blog of the author.
%o A375477 (Python)
%o A375477 from itertools import count, islice
%o A375477 def bgen(ds): # generator of terms with digital sum ds
%o A375477     def A051885(n): return ((n%9)+1)*10**(n//9)-1 # due to Chai Wah Wu
%o A375477     def A228915(n): # due to M. F. Hasler
%o A375477         p = r = 0
%o A375477         while True:
%o A375477             d = n % 10
%o A375477             if d < 9 and r: return (n+1)*10**p + A051885(r-1)
%o A375477             n //= 10; r += d; p += 1
%o A375477     k = A051885(ds)
%o A375477     while True: yield k; k = A228915(k)
%o A375477 def agen(): # generator of terms
%o A375477     an, ds_block, seen, link_set, min2 = 0, 0, set(), "123456789", 11
%o A375477     while True:
%o A375477         yield an
%o A375477         seen.add(an)
%o A375477         if ds_block == 8:
%o A375477             while min2 in seen: min2 = 10*min2 - 9
%o A375477             an, ds_an, link_an = min2, 2, "1"
%o A375477         else:
%o A375477             cand_ds = list(range(1, 9-ds_block)) + [10-ds_block]
%o A375477             dsg = [0] + [bgen(i) for i in range(1, 11-ds_block)]
%o A375477             dsi = [0] + [(next(dsg[i]), i) for i in range(1, 11-ds_block)]
%o A375477             while True:
%o A375477                 k, ds_k = min(dsi[j] for j in cand_ds)
%o A375477                 if k not in seen:
%o A375477                     sk, dst = str(k), ds_k + ds_block
%o A375477                     if sk[0] in link_set:
%o A375477                         if dst < 9 or (dst == 10 and k%10 != 0):
%o A375477                             an, ds_an, link_an = k, ds_k, sk[-1]
%o A375477                             break
%o A375477                 dsi[ds_k] = (next(dsg[ds_k]), ds_k)
%o A375477         ds_block = ds_block + ds_an
%o A375477         if ds_block == 10: ds_block, link_set = 0, link_an
%o A375477         else: link_set = "123456789"
%o A375477 print(list(islice(agen(), 60)))
%Y A375477 Cf. A375460.
%K A375477 base,nonn
%O A375477 1,3
%A A375477 _Eric Angelini_ and _Michael S. Branicky_, Aug 17 2024