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.

A107353 a(0)=0, a(n) = smallest integer not previously used which contains a digit from a(n-1).

This page as a plain text file.
%I A107353 #18 Oct 03 2024 17:13:17
%S A107353 0,10,1,11,12,2,20,21,13,3,23,22,24,4,14,15,5,25,26,6,16,17,7,27,28,8,
%T A107353 18,19,9,29,32,30,31,33,34,35,36,37,38,39,43,40,41,42,44,45,46,47,48,
%U A107353 49,54,50,51,52,53,55,56,57,58,59,65,60,61,62,63,64,66,67,68,69,76,70
%N A107353 a(0)=0, a(n) = smallest integer not previously used which contains a digit from a(n-1).
%H A107353 Michael S. Branicky, <a href="/A107353/b107353.txt">Table of n, a(n) for n = 0..10000</a>
%F A107353 For n > 28, and 2 <= j <= 10, a(j*10^k) = j*10^k + (j-1).
%e A107353 [10] is the smallest available integer having a "0". [1] is the smallest available integer having a "1" or a "0". [11] is the smallest integer having a 1, etc.
%e A107353 When restricted to {0..9999} this sequence is a permutation with the following cycle representation:
%e A107353 (1, 10, 23, 27, 19, 6, 20, 16, 5, 2)
%e A107353 (3, 11, 22, 7, 21, 17, 25, 8, 13, 4, 12, 24, 28, 9)
%e A107353 (18, 26)
%e A107353 (30, 32, 31)
%e A107353 (40, 43, 42, 41)
%e A107353 (50, 54, 53, 52, 51)
%e A107353 (60, 65, 64, 63, 62, 61)
%e A107353 (70, 76, 75, 74, 73, 72, 71)
%e A107353 (80, 87, 86, 85, 84, 83, 82, 81)
%e A107353 (100, 109, 108, 107, 106, 105, 104, 103, 102, 101)
%e A107353 (200, 201)
%e A107353 (300, 302, 301)
%e A107353 (400, 403, 402, 401)
%e A107353 (500, 504, 503, 502, 501)
%e A107353 (600, 605, 604, 603, 602, 601)
%e A107353 (700, 706, 705, 704, 703, 702, 701)
%e A107353 (800, 807, 806, 805, 804, 803, 802, 801)
%e A107353 (1000, 1009, 1008, 1007, 1006, 1005, 1004, 1003, 1002, 1001)
%e A107353 (2000, 2001)
%e A107353 (3000, 3002, 3001)
%e A107353 (4000, 4003, 4002, 4001)
%e A107353 (5000, 5004, 5003, 5002, 5001)
%e A107353 (6000, 6005, 6004, 6003, 6002, 6001)
%e A107353 (7000, 7006, 7005, 7004, 7003, 7002, 7001)
%e A107353 (8000, 8007, 8006, 8005, 8004, 8003, 8002, 8001)
%e A107353 - _Jason Kimberley_, Dec 22 2011
%t A107353 f[l_] := Block[{c = 0}, While[ MemberQ[l, c] || Intersection @@ IntegerDigits /@ {Last[l], c} == {}, c++ ]; Return[Append[l, c]] ]; Nest[f, {0}, 71] (* _Ray Chandler_, May 23 2005 *)
%o A107353 (Python)
%o A107353 from itertools import count, islice
%o A107353 def agen(): # generator of terms
%o A107353     an, aset, mink = 0, {0}, 1
%o A107353     while True:
%o A107353         yield an
%o A107353         digset = set(str(an))
%o A107353         an = next(k for k in count(mink) if k not in aset and set(str(k))&digset)
%o A107353         aset.add(an)
%o A107353         while mink in aset: mink += 1
%o A107353 print(list(islice(agen(), 72))) # _Michael S. Branicky_, Oct 03 2024
%K A107353 base,easy,nonn
%O A107353 0,2
%A A107353 _Eric Angelini_, May 21 2005
%E A107353 Extended by _Ray Chandler_, May 23 2005