login
A350672
a(n) is the smallest number larger than a(n-1) that has only two digits in common with a(n-1).
2
1, 11, 12, 21, 22, 23, 32, 33, 34, 43, 44, 45, 54, 55, 56, 65, 66, 67, 76, 77, 78, 87, 88, 89, 98, 99, 109, 112, 130, 132, 134, 135, 136, 137, 138, 139, 141, 150, 152, 153, 154, 156, 157, 158, 159, 161, 170, 172, 173, 174, 175, 176, 178, 179, 181, 190, 192, 193, 194, 195
OFFSET
1,2
COMMENTS
Terms computed by Claudio Meller.
See A350671 for the definition of number of digits in common between x and y. In particular, if x has r digits in common with y, then y also has r digits in common with x. - Jianing Song, May 07 2022
EXAMPLE
a(11) = 44 because it is the smallest number larger than a(10) = 43 that has exactly two digits in common.
Similarly, a(27) = 109 because it is the smallest number larger than a(26) = 99 that has exactly two digits in common (the digit 9 of 109 it is in common with the first and second 9 of 99).
MATHEMATICA
a[1]=1; a[n_]:=a[n]=(k=a[n-1]+1; While[Total[Count[IntegerDigits@a[n-1], #]&/@IntegerDigits@k]!=2, k++]; k); Array[a, 60] (* Giorgos Kalogeropoulos, Jan 12 2022 *)
PROG
(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 = 1, "1"
while True:
yield an
k = an + 1
while c(str(k), target) != 2: k += 1
an, target = k, str(k)
print(list(islice(agen(), 76))) # Michael S. Branicky, Jan 10 2022
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rodolfo Kurchan, Jan 10 2022
STATUS
approved