OFFSET
1,2
COMMENTS
A permutation of the positive integers.
LINKS
MATHEMATICA
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 *)
PROG
(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
(Haskell)
import Data.List (delete, intersect); import Data.Function (on)
a184992 n = a184992_list !! (n-1)
a184992_list = 1 : f 1 [2..] where
f u vs = v : f v (delete v vs)
where v : _ = filter (not . null . (intersect `on` show) u) vs
-- Reinhard Zumkeller, Jul 01 2013
(Python)
from itertools import count, islice
def agen(): # generator of terms
an, aset, mink = 1, {1}, 1
while True:
yield an
digset = set(str(an))
an = next(k for k in count(mink) if k not in aset and set(str(k))&digset)
aset.add(an)
while mink in aset: mink += 1
print(list(islice(agen(), 74))) # Michael S. Branicky, Oct 03 2024
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Eric Angelini, Dec 22 2011
STATUS
approved