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.

A249591 Lexicographically earliest permutation of the integers such that a(n+1) shares at least one digit with a(n)-1.

Original entry on oeis.org

1, 10, 9, 8, 7, 6, 5, 4, 3, 2, 11, 12, 13, 14, 15, 16, 17, 18, 19, 21, 20, 29, 22, 23, 24, 25, 26, 27, 28, 32, 30, 39, 31, 33, 34, 35, 36, 37, 38, 43, 40, 49, 41, 42, 44, 45, 46, 47, 48, 54, 50, 59, 51, 52, 53, 55, 56, 57, 58, 65, 60, 69, 61, 62, 63, 64, 66, 67, 68, 70, 76, 71
Offset: 1

Views

Author

Eric Angelini and M. F. Hasler, Nov 01 2014

Keywords

Crossrefs

Cf. A249585.
Cf. A184992.

Programs

  • Haskell
    import Data.List (intersect, delete)
    a249591 n = a249591_list !! (n-1)
    a249591_list = 1 : f 1 [2..] where
       f x zs = g zs where
         g (y:ys) = if null $ show y `intersect` show (x - 1)
                       then g ys else y : f y (delete y zs)
    -- Reinhard Zumkeller, Nov 02 2014
  • PARI
    {u=0; a=1; for(n=1, 99, print1(a","); u+=1<1,digits(a-1))); for(k=2, 9e9, bittest(u, k)&&next; #setintersect(D, Set(digits(k)))||next; a=k; break))}