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.

A336285 a(0) = 0; for n > 0, a(n) is the least positive integer not occurring earlier such that the digits in a(n-1)+a(n) are all distinct.

This page as a plain text file.
%I A336285 #53 Jul 09 2025 04:53:39
%S A336285 0,1,2,3,4,5,7,6,8,9,10,11,12,13,14,15,16,18,17,19,20,21,22,23,24,25,
%T A336285 26,27,29,28,30,31,32,33,34,35,36,37,38,40,39,41,42,43,44,45,46,47,48,
%U A336285 49,53,50,52,51,54,55,65,58,62,61,59,64,56,67,57,63,60,66,68,69,70,72,71,74,73,75,77
%N A336285 a(0) = 0; for n > 0, a(n) is the least positive integer not occurring earlier such that the digits in a(n-1)+a(n) are all distinct.
%C A336285 In other words, for any n > 0, a(n) + a(n+1) belongs to A010784.
%C A336285 The sequence is finite since there are only a finite number of positive integers with distinct digits, see A010784, although the exact number of terms is currently unknown.
%H A336285 Rémy Sigrist, <a href="/A336285/b336285.txt">Table of n, a(n) for n = 0..10000</a>
%H A336285 Scott R. Shannon, <a href="/A342408/a342408.png">Image of the first 1000000 terms</a>. The green line is a(n) = n.
%e A336285 The first terms, alongside a(n) + a(n+1), are:
%e A336285   n   a(n)  a(n)+a(n+1)
%e A336285   --  ----  -----------
%e A336285    0     0            1
%e A336285    1     1            3
%e A336285    2     2            5
%e A336285    3     3            7
%e A336285    4     4            9
%e A336285    5     5           12
%e A336285    6     7           13
%e A336285    7     6           14
%e A336285    8     8           17
%e A336285    9     9           19
%e A336285   10    10           21
%o A336285 (PARI) s=0; v=1; for (n=1, 67, print1 (v", "); s+=2^v; for (w=1, oo, if (!bittest(s, w) && #(d=digits(v+w))==#Set(d), v=w; break)))
%o A336285 (Python)
%o A336285 def agen():
%o A336285   alst, aset, min_unused = [0], {0}, 1
%o A336285   yield 0
%o A336285   while True:
%o A336285     an = min_unused
%o A336285     while True:
%o A336285       while an in aset: an += 1
%o A336285       t = str(alst[-1] + an)
%o A336285       if len(t) == len(set(t)):
%o A336285         alst.append(an); aset.add(an); yield an
%o A336285         if an == min_unused: min_unused = min(set(range(max(aset)+2))-aset)
%o A336285         break
%o A336285       an += 1
%o A336285 g = agen()
%o A336285 print([next(g) for n in range(77)]) # _Michael S. Branicky_, Mar 11 2021
%Y A336285 Cf. A342383, A338466, A322845, A010784, A043537, A043096, A276633, A002378.
%K A336285 nonn,base,fini,look
%O A336285 0,3
%A A336285 _Rémy Sigrist_, Jul 22 2020
%E A336285 a(0)=0 added by _N. J. A. Sloane_, Mar 14 2021