cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

This page as a plain text file.
%I A342383 #20 Mar 14 2021 10:52:42
%S A342383 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,
%T A342383 29,28,30,31,32,35,34,36,37,38,40,39,41,42,43,46,45,47,48,49,53,50,52,
%U A342383 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
%N 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.
%C A342383 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.
%H A342383 Scott R. Shannon, <a href="/A342383/a342383.png">Image of the first 60000 terms</a>. The green line is a(n) = n.
%e A342383 a(1) = 1 as 1 has one distinct digit and a(0)+1 = 0+1 = 1 which has one distinct digit 0.
%e A342383 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.
%e A342383 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.
%t A342383 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 *)
%o A342383 (Python)
%o A342383 def agen():
%o A342383   alst, aset = [0], {0}
%o A342383   yield 0
%o A342383   while True:
%o A342383     an = 1
%o A342383     while True:
%o A342383       while an in aset: an += 1
%o A342383       stran, t = str(an), str(alst[-1] + an)
%o A342383       if len(stran) == len(set(stran)) and len(t) == len(set(t)):
%o A342383         alst.append(an); aset.add(an); yield an; break
%o A342383       an += 1
%o A342383 g = agen()
%o A342383 print([next(g) for n in range(77)]) # _Michael S. Branicky_, Mar 11 2021
%Y A342383 Cf. A336285, A342382, A010784, A043537, A043096, A276633, A002378.
%K A342383 nonn,base,fini,look
%O A342383 0,3
%A A342383 _Scott R. Shannon_, Mar 09 2021