login
a(n) is the smallest number larger than a(n-1) that has only one digit in common with a(n-1).
5

%I #25 Jan 07 2022 15:50:25

%S 1,10,12,13,14,15,16,17,18,19,21,23,24,25,26,27,28,29,32,34,35,36,37,

%T 38,39,43,45,46,47,48,49,54,56,57,58,59,65,67,68,69,76,78,79,87,89,90,

%U 91,92,93,94,95,96,97,98,108,122,130,142,150,162,170,182,190,202,301,322,340,351,360,371,380,391,401,422,430

%N a(n) is the smallest number larger than a(n-1) that has only one digit in common with a(n-1).

%C Terms computed by _Claudio Meller_.

%e a(11) = 21 because it is the smallest number larger than a(10) = 19 that has exactly one digit in common.

%e Similarly, a(55) = 108 because it is the smallest number larger than a(54) = 98 that has exactly one digit in common.

%t j = 1; {j}~Join~Reap[Do[d = Union@ IntegerDigits[j]; k = j + 1; While[Count[IntegerDigits[k], _?(MemberQ[d, #] &)] != 1, k++]; Sow[k]; j = k, 82]][[-1, -1]] (* _Michael De Vlieger_, Dec 31 2021 *)

%o (Python)

%o from itertools import islice

%o def c(s, t): return sum(t.count(si) for si in s)

%o def agen(): # generator of terms

%o an, target = 1, "1"

%o while True:

%o yield an

%o k = an + 1

%o while c(str(k), target) != 1: k += 1

%o an, target = k, str(k)

%o print(list(islice(agen(), 75))) # _Michael S. Branicky_, Dec 31 2021

%Y Cf. A350444.

%K nonn,base

%O 1,2

%A _Rodolfo Kurchan_, Dec 31 2021