|
|
A362335
|
|
Lexicographically earliest sequence of distinct nonnegative terms wherein every digit of a(n) is the absolute difference of two adjacent digits in a(n+1).
|
|
1
|
|
|
0, 11, 10, 100, 110, 112, 102, 1002, 1022, 1102, 1120, 1124, 1026, 10028, 10086, 10082, 10866, 10822, 10886, 10882, 11086, 11082, 11208, 11976, 10928, 100913, 10096, 10093, 10966, 10933, 10996, 10993, 11096, 11093, 22309, 11309, 23009, 13009, 23099, 13099, 23309
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
COMMENTS
|
All terms > a(24) contain at least one 9 with an adjacent 0. All terms > a(25) contain at least one instance of identical adjacent digits.
|
|
LINKS
|
|
|
EXAMPLE
|
a(125) = 9902. The next term is 10097, not 20009, because, in spite of its providing more digit differences than are needed, it is lexicographically earlier.
|
|
PROG
|
(Python)
from itertools import count, islice
def c(k, d):
dk = list(map(int, str(k)))
return set(abs(dk[i+1]-dk[i]) for i in range(len(dk)-1)) >= d
def agen(): # generator of terms
an, aset = 0, {0}
while True:
yield an
d = set(map(int, set(str(an))))
an = next(k for k in count(10**len(d)) if k not in aset and c(k, d))
aset.add(an)
while len(A) <= n:
z = lambda a: zip(d := tuple(int(d) for d in str(a)), d[1:])
D = set(str(A[-1])) ; a = 10**len(D)
while a in A or D - set(str(abs(x-y)) for x, y in z(a)): a += 1
A . append(a)
(PARI) {upto(N) = my(U=[], a=0); vector(N, n, if(n>1, my(da=Set(if(a, digits(a)))); a=10^#da; while( setsearch(U, a) || #setminus(da, Set(abs((n=digits(a))[^1]-n[^-1]))), a++)); U=setunion(U, [a]); a)} \\ M. F. Hasler, May 27 2023
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|