A395817
Strictly increasing minimal sequence where consecutive terms can be added digit-by-digit without carrying in base 10.
Many integers (e.g., 6, 7, 8, 9, 15, 16...) are never present because the greedy behavior and the strictly increasing condition bypass them to avoid carries.A subset of nonnegative integers with no decimal digits > 5 (A007092).
Sequence Chart
Data
1,2,3,4,5,10,11,12,13,14,15,20,21,22,23,24,25,30,31,32,33,34,35,40,41,42,43,44,45,50,100,101,102,103,104,105,110,111,112,113,114,115,120,121,122,123,124,125,130,131,132,133,134,135,140,141,142,143,144
Formula
a(1)=1; a(n) = min { x > a(n-1) | d_i(x) + d_i(a(n-1)) <= 9 }.
Computational Implementations
PYTHON
def has_carry(a, b):
while a or b:
if (a % 10) + (b % 10) > 9:
return True
a //= 10; b //= 10
return False
def sequence(n):
terms = [1]
while len(terms) < n:
k = terms[-1] + 1
while has_carry(terms[-1], k):
k += 1
terms.append(k)
return terms Mathematica
s={1};k=2;Do[While[Max[IntegerDigits[k]]>5||Max[IntegerDigits[s[[-1]]]+Take[IntegerDigits[k],-IntegerLength[s[[-1]]]]]> 9,k++];AppendTo[s,k];k++,{i,58}];s Cross-References
See also OEIS entries: Cf. A052413, A007092.