|
|
A342383
|
|
a(0) = 0; for n > 0, a(n) is the least positive integer not occurring earlier such that both the digits in a(n) and the digits in a(n-1)+a(n) are all distinct.
|
|
4
|
|
|
0, 1, 2, 3, 4, 5, 7, 6, 8, 9, 10, 13, 12, 14, 15, 16, 18, 17, 19, 20, 21, 24, 23, 25, 26, 27, 29, 28, 30, 31, 32, 35, 34, 36, 37, 38, 40, 39, 41, 42, 43, 46, 45, 47, 48, 49, 53, 50, 52, 51, 54, 69, 56, 64, 59, 61, 62, 58, 65, 60, 63, 57, 67, 68, 70, 72, 71, 74, 73, 75, 78, 76, 80, 79, 81, 82, 83
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
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
|
|
|
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()
|
|
CROSSREFS
|
|
|
KEYWORD
|
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|