A374530 Lexicographically earliest permutation of the nonnegative terms such that the absolute difference between the rightmost digit of a(n) and the leftmost digit of a(n+1) is the smallest possible one.
0, 1, 10, 11, 12, 2, 20, 13, 3, 30, 14, 4, 40, 15, 5, 50, 16, 6, 60, 17, 7, 70, 18, 8, 80, 19, 9, 90, 100, 101, 102, 21, 103, 31, 104, 41, 105, 51, 106, 61, 107, 71, 108, 81, 109, 91, 110, 111, 112, 22, 23, 32, 24, 42, 25, 52, 26, 62, 27, 72, 28, 82, 29, 92, 200, 113, 33, 34, 43, 35, 53, 36, 63, 37, 73
Offset: 1
Examples
The digits touching the 1st comma (0 and 1) have an absolute difference of 1; The digits touching the 2nd comma (1 and 1) have an absolute difference of 0; The digits touching the 3rd comma (0 and 1) have an absolute difference of 1; The digits touching the 4th comma (1 and 1) have an absolute difference of 0; The digits touching the 5th comma (2 and 2) have an absolute difference of 0; The digits touching the 6th comma (2 and 2) have an absolute difference of 0; The digits touching the 7th comma (0 and 1) have an absolute difference of 1; The digits touching the 8th comma (3 and 3) have an absolute difference of 0; The digits touching the 9th comma (3 and 3) have an absolute difference of 0; etc.
Links
- Dominic McCarty, Table of n, a(n) for n = 1..10000
Programs
-
Python
from itertools import count a = [0] while len(a) < 30: a.append(next(k for k in count() if k not in a and ((r:=a[-1]%10)==(l:=int(str(k)[0])) or ((r,l)==(0,1))))) print(a) # Dominic McCarty, Mar 24 2025
Comments