OFFSET
1,2
COMMENTS
The sequence is finite, as Q(n) cannot be > 9876543210. What is the last term of the sequence?
EXAMPLE
a(9) = 9 and Q(9) = 45;
a(10) = 11 and Q(10) = 56: a(10) cannot = 10 as Q(10) would = 55;
a(11) = 12 and Q(11) = 68: a(11) cannot = 10 as Q(11) would = 66;
a(12) = 10 and Q(12) = 78;
a(13) = 13 and Q(13) = 91; etc.
MATHEMATICA
a[1]=1; a[n_]:=a[n]=(k=1; While[!DuplicateFreeQ@IntegerDigits@ Total[Join[c=Array[a, n-1], {k}]]||MemberQ[c, k], k++]; k); Array[a, 70] (* Giorgos Kalogeropoulos, Jul 19 2023 *)
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Eric Angelini, Jul 17 2023
STATUS
approved