OFFSET
0,3
COMMENTS
The sequence is finite due to the finite number of positive integers with distinct digits, see A010784, although the exact number of terms is currently unknown.
LINKS
Scott R. Shannon, Image of the first 60000 terms. The green line is a(n) = n.
EXAMPLE
a(1) = 1 as 1 has one distinct digit and a(0)+1 = 0+1 = 1 which has one distinct digit 0.
a(6) = 7 as 7 has one distinct digit and a(5)+7 = 5+7 = 12 which has two distinct digits. Note that 6 is the first skipped number as a(5)+6 = 5+6 = 11 has 1 as a duplicate digit.
a(11) = 13 as 13 has two distinct digits and a(10)+13 = 10+13 = 23 which has two distinct digits. Note that 11 and 12 are skipped as 11 has 1 as a duplicate digit while a(10)+12 = 10+12 = 22 has 2 as a duplicate digit.
MATHEMATICA
Block[{a = {0}, k, m = 10^4}, Do[k = 1; While[Nand[FreeQ[a, k], AllTrue[DigitCount[a[[-1]] + k], # < 2 &], AllTrue[DigitCount[k], # < 2 &]], If[k > m, Break[]]; k++]; If[k > m, Break[]]; AppendTo[a, k], {i, 76}]; a] (* Michael De Vlieger, Mar 11 2021 *)
PROG
(Python)
def agen():
alst, aset = [0], {0}
yield 0
while True:
an = 1
while True:
while an in aset: an += 1
stran, t = str(an), str(alst[-1] + an)
if len(stran) == len(set(stran)) and len(t) == len(set(t)):
alst.append(an); aset.add(an); yield an; break
an += 1
g = agen()
print([next(g) for n in range(77)]) # Michael S. Branicky, Mar 11 2021
CROSSREFS
KEYWORD
AUTHOR
Scott R. Shannon, Mar 09 2021
STATUS
approved