login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A335971 The Locomotive Pulling the Wagons to the Left sequence (see Comments lines for definition). 3
13, 20, 14, 24, 30, 15, 25, 31, 26, 35, 40, 16, 27, 36, 41, 28, 37, 42, 38, 46, 50, 17, 29, 39, 47, 51, 48, 52, 49, 53, 402, 18, 57, 60, 19, 58, 61, 59, 62, 302, 102, 103, 104, 105, 106, 107, 63, 403, 108, 64, 502, 109, 68, 70, 69, 71, 202, 113, 203, 114, 204, 115, 205, 116, 206 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
COMMENTS
a(1) is the locomotive; a(2), a(3), a(4),... a(n),... are the successive wagons. To hook a wagon to its predecessor (on the left) you must be able to insert the leftmost digit of a(n) between the last two digits of a(n-1). In mathematical terms, the value of the leftmost digit of a(n) must be between (not equal to) the penultimate and the last digit of a(n-1). This is the lexicographically earliest sequence of distinct positive terms with this property.
LINKS
EXAMPLE
The sequence starts with 13, 20, 14, 24, 30,...
a(1) = 13 as there is no earliest possible (pulling to the left) locomotive;
a(2) = 20 starts with 2 and 1 < 2 < 3 [1 and 3 being the last two digits of a(1)];
a(3) = 14 starts with 1 and 2 > 1 > 0 [2 and 0 being the last two digits of a(2)];
a(4) = 24 starts with 2 and 1 < 2 < 4 [1 and 4 being the last two digits of a(3)]; etc.
PROG
(Python)
def dead_end(k): return abs((k//10)%10 - k%10) <= 1
def aupto(n, seed=13):
train, used = [seed], {seed}
for n in range(2, n+1):
caboose = train[-1]
h1, h2 = sorted([(caboose//10)%10, caboose%10])
hooks = set(range(h1+1, h2))
pow10 = 10
an = min(hooks)*pow10
while an in used: an += 1
hook = an//pow10
while True:
if hook in hooks:
if not dead_end(an):
train.append(an)
used.add(an)
break
else: pow10 *= 10
an = max(an+1, min(hooks)*pow10)
while an in used: an += 1
hook = an//pow10
return train # use train[n-1] for a(n)
print(aupto(65)) # Michael S. Branicky, Dec 14 2020
CROSSREFS
Cf. A335972 (locomotive pushing to the right) and A335973 (two locomotives).
Sequence in context: A145944 A355964 A330425 * A176150 A095040 A069195
KEYWORD
base,nonn
AUTHOR
Eric Angelini and Carole Dubois, Jul 03 2020
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 3 07:27 EDT 2024. Contains 375649 sequences. (Running on oeis4.)