OFFSET
1,2
COMMENTS
Only numbers starting with 1 or 9 are in the sequence, except for a(1).
The first 9 absolute differences are 9,8,8,9,8,7,6,5,4. The next 20 absolute differences form a pattern that repeats itself forever: 9,5,8,6,7,7,6,8,5,9,8,7,6,5,4,4,5,6,7,8.
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..10000
EXAMPLE
The digits touching the 1st comma (0 and 9) have an absolute difference of 9;
The digits touching the 2nd comma (9 and 1) have an absolute difference of 8;
The digits touching the 3rd comma (1 and 9) have an absolute difference of 8;
The digits touching the 4th comma (0 and 9) have an absolute difference of 9;
The digits touching the 5th comma (1 and 9) have an absolute difference of 8;
The digits touching the 6th comma (2 and 9) have an absolute difference of 7;
The digits touching the 7th comma (3 and 9) have an absolute difference of 6;
The digits touching the 8th comma (4 and 9) have an absolute difference of 5;
The digits touching the 9th comma (5 and 1) have an absolute difference of 4; from now on, the absolute differences enter into a loop.
PROG
(Python)
from itertools import islice
def gen(d): # generator of terms that start with d
pow10 = 1
while True:
for i in range(d*pow10, (d+1)*pow10):
yield i
pow10 *= 10
def agen(): # generator of terms
an, g1, g9 = 0, gen(1), gen(9)
next1, next9 = next(g1), next(g9)
while True:
yield an
rightmost = an%10
if rightmost > 5 or (rightmost == 5 and next1 < next9):
an, next1 = next1, next(g1)
else:
an, next9 = next9, next(g9)
print(list(islice(agen(), 70))) # Michael S. Branicky, Jul 13 2024
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Eric Angelini, Jul 09 2024
STATUS
approved