A350444 a(n) is the smallest number that has not appeared yet in the sequence and has only one digit in common with a(n-1).
1, 10, 12, 2, 20, 21, 13, 3, 23, 24, 4, 14, 15, 5, 25, 26, 6, 16, 17, 7, 27, 28, 8, 18, 19, 9, 29, 32, 30, 31, 34, 35, 36, 37, 38, 39, 43, 40, 41, 42, 45, 46, 47, 48, 49, 54, 50, 51, 52, 53, 56, 57, 58, 59, 65, 60, 61, 62, 63, 64, 67, 68, 69, 76, 70, 71, 72, 73, 74, 75, 78, 79, 87, 80, 81, 82, 83, 84, 85, 86, 89, 90
Offset: 1
Examples
a(2) = 10 because it is the smallest number that has exactly one digit in common with a(1) = 1; similarly, a(3) = 12 because it has one digit in common with a(2) = 10 and a(4) = 2 because it is the smallest number that is not already in the sequence that has exactly one digit in common with a(3) = 12.
Links
- Michael De Vlieger, Log-log scatterplot of a(n) for n = 1..10000 labeling the first 40 terms.
Programs
-
Mathematica
c[] = False; j = c[1] = 1; {j}~Join~Reap[Do[d = Union@ IntegerDigits[j]; If[j == u, While[c[u] > 0, u++]]; k = u; While[Nand[c[k] == False, Count[IntegerDigits[k], ?(MemberQ[d, #] &)] == 1], k++]; Sow[k]; c[k] = True; j = k, 81]][[-1, -1]] (* Michael De Vlieger, Dec 31 2021 *)
-
Python
from itertools import islice def c(s, t): return sum(t.count(si) for si in s) def agen(): # generator of terms an, target, seen, mink = 1, "1", {1}, 2 while True: yield an k = mink while k in seen or c(str(k), target) != 1: k += 1 an, target = k, str(k) seen.add(an) while mink in seen: mink += 1 print(list(islice(agen(), 82))) # Michael S. Branicky, Dec 31 2021
Comments