A382621 Lexicographically earliest sequence of distinct positive integers such that if a digit d in the digit stream (ignoring commas) is even, the previous digit is > d.
1, 3, 2, 5, 4, 7, 6, 9, 8, 10, 11, 13, 15, 17, 19, 20, 30, 31, 32, 33, 21, 35, 23, 25, 27, 29, 37, 39, 40, 50, 51, 52, 53, 54, 55, 41, 57, 42, 59, 43, 70, 71, 72, 73, 74, 75, 45, 47, 49, 60, 76, 77, 61, 79, 62, 90, 91, 92, 93, 94, 95, 96, 97, 63, 98, 64, 99, 65, 101, 103
Offset: 1
Links
- Paolo Xausa, Table of n, a(n) for n = 1..10000
- Paolo Xausa, Color scatterplot of the first 100000 terms
Programs
-
Mathematica
A382621list[nmax_] := Module[{a, s, invQ, fu = 2}, invQ[k_] := invQ[k] = (If[#, s[k] = #]; #) & [MemberQ[Partition[IntegerDigits[k], 2, 1], {i_, j_?EvenQ} /; i <= j]]; s[_] := False; s[1] = True; NestList[(a = fu; While[s[a] || invQ[a] || invQ[# + First[IntegerDigits[a]]], a++] & [Max[Mod[#, 10], 1]*10]; While[s[fu], fu++]; s[a] = True; a) &, 1, nmax - 1]]; A382621list[100]
-
Python
from itertools import count, islice def cond(s): return all(s[i+1] < s[i] for i in range(len(s)-1) if s[i+1] in "02468") def agen(): # generator of terms an, seen, s, m = 1, {1}, "1", 2 while True: yield an an = next(k for k in count(m) if k not in seen and cond(s[-1]+str(k))) seen.add(an); s += str(an) while m in seen or not cond(str(m)): m += 1 print(list(islice(agen(), 70))) # Michael S. Branicky, Apr 03 2025
Comments