OFFSET
0,3
LINKS
John Tyler Rascoe, Table of n, a(n) for n = 0..10000
EXAMPLE
DS stands hereunder for DigitSum:
a(0) = 0 (DS 0) and a(2) = 10 (DS 1) and the absolute difference 0 - 1 = 1;
a(1) = 1 (DS 1) and a(3) = 2 (DS 2) and the absolute difference 1 - 2 = 1;
a(2) = 10 (DS 1) and a(4) = 11 (DS 2) and the absolute difference 1 - 2 = 1;
a(3) = 2 (DS 2) and a(5) = 3 (DS 3) and the absolute difference 2 - 3 = 1;
a(4) = 11 (DS 2) and a(6) = 12 (DS 3) and the absolute difference 2 - 3 = 1; etc.
PROG
(Python)
from itertools import count, filterfalse
def DS(y):
z = str(y)
return sum(int(z[i]) for i in range (0, len(z)))
def A366197_list(n_max):
A = [0, 1]
S = set(A)
for n in range(2, n_max+1):
for i in filterfalse(S.__contains__, count(1)):
if abs(DS(A[n-2])-DS(i)) == 1:
A.append(i)
S.add(i)
break
return(A) # John Tyler Rascoe, Oct 22 2023
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Eric Angelini, Oct 03 2023
EXTENSIONS
More terms from Alois P. Heinz, Oct 03 2023
STATUS
approved