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.

A184992 a(n) is the least positive integer not occurring earlier that shares a digit with a(n-1); a(1)=1.

This page as a plain text file.
%I A184992 #32 Oct 03 2024 15:13:26
%S A184992 1,10,11,12,2,20,21,13,3,23,22,24,4,14,15,5,25,26,6,16,17,7,27,28,8,
%T A184992 18,19,9,29,32,30,31,33,34,35,36,37,38,39,43,40,41,42,44,45,46,47,48,
%U A184992 49,54,50,51,52,53,55,56,57,58,59,65,60,61,62,63,64,66,67,68,69,76,70,71,72,73
%N A184992 a(n) is the least positive integer not occurring earlier that shares a digit with a(n-1); a(1)=1.
%C A184992 A permutation of the positive integers.
%H A184992 Reinhard Zumkeller, <a href="/A184992/b184992.txt">Table of n, a(n) for n = 1..10000</a>
%H A184992 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%t A184992 FromDigits /@ Nest[Function[a, Append[a, Block[{k = 2, d}, While[Nand[FreeQ[a, #], IntersectingQ[a[[-1]], #]] &@ Set[d, IntegerDigits@ k], k++]; d]]], {{1}}, 73] (* _Michael De Vlieger_, Mar 17 2018 *)
%o A184992 (PARI) A184992(n,show=0)={my(a=1,u=2^1);for(k=2,n,show && print1(a",");a=Set(Vec(Str(a))); for(j=2,9e9,bittest(u,j) && next;setintersect(Set(Vec(Str(j))),a) || next; u+=2^a=j; break));a}  \\ _M. F. Hasler_, Dec 22 2011
%o A184992 (Haskell)
%o A184992 import Data.List (delete, intersect); import Data.Function (on)
%o A184992 a184992 n = a184992_list !! (n-1)
%o A184992 a184992_list = 1 : f 1 [2..] where
%o A184992    f u vs = v : f v (delete v vs)
%o A184992      where v : _ = filter (not . null . (intersect `on` show) u) vs
%o A184992 -- _Reinhard Zumkeller_, Jul 01 2013
%o A184992 (Python)
%o A184992 from itertools import count, islice
%o A184992 def agen(): # generator of terms
%o A184992     an, aset, mink = 1, {1}, 1
%o A184992     while True:
%o A184992         yield an
%o A184992         digset = set(str(an))
%o A184992         an = next(k for k in count(mink) if k not in aset and set(str(k))&digset)
%o A184992         aset.add(an)
%o A184992         while mink in aset: mink += 1
%o A184992 print(list(islice(agen(), 74))) # _Michael S. Branicky_, Oct 03 2024
%Y A184992 Cf. A162501, A076654, A130571.
%Y A184992 a(n) = A107353(n) for n>=3. - _Alois P. Heinz_, Dec 22 2011
%Y A184992 Cf. A227118 (inverse); A067581.
%K A184992 nonn,base
%O A184992 1,2
%A A184992 _Eric Angelini_, Dec 22 2011