A375460 Lexicographically earliest sequence of distinct nonnegative terms arranged in successive chunks whose digitsum = 10.
0, 1, 2, 3, 4, 5, 10, 11, 20, 6, 12, 100, 7, 21, 8, 101, 9, 1000, 13, 14, 10000, 15, 22, 16, 30, 17, 110, 18, 100000, 19, 23, 31, 1000000, 24, 40, 25, 102, 26, 200, 27, 10000000, 28, 32, 41, 33, 103, 34, 111, 35, 1001, 36, 100000000, 37, 42, 112, 43, 120, 44, 1010, 45, 1000000000
Offset: 1
Examples
The first chunk of integers with digitsum 10 is (0,1,2,3,4); the next one is (5,10,11,20), the next one is (6,12,100), the next one is (7,21), the next one is (8,101), the next one is (9,1000), the next one is (13,14,10000), etc. The concatenation of the above chunks produce the sequence.
Links
- Michael S. Branicky, Table of n, a(n) for n = 1..6491
Crossrefs
Programs
-
Python
from itertools import islice def bgen(ds): # generator of terms with digital sum ds def A051885(n): return ((n%9)+1)*10**(n//9)-1 # due to Chai Wah Wu def A228915(n): # due to M. F. Hasler p = r = 0 while True: d = n % 10 if d < 9 and r: return (n+1)*10**p + A051885(r-1) n //= 10; r += d; p += 1 k = A051885(ds) while True: yield k; k = A228915(k) def agen(): # generator of terms an, ds_block = 0, 0 dsg = [None] + [bgen(i) for i in range(1, 11)] dsi = [None] + [(next(dsg[i]), i) for i in range(1, 11)] while True: yield an an, ds_an = min(dsi[j] for j in range(1, 11-ds_block)) ds_block = (ds_block + ds_an)%10 dsi[ds_an] = (next(dsg[ds_an]), ds_an) print(list(islice(agen(), 61))) # Michael S. Branicky, Aug 16 2024
Extensions
a(46) and beyond from Michael S. Branicky, Aug 16 2024.
Comments