login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A249591 Lexicographically earliest permutation of the integers such that a(n+1) shares at least one digit with a(n)-1. 6

%I #13 Jan 02 2023 12:30:51

%S 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,

%T 26,27,28,32,30,39,31,33,34,35,36,37,38,43,40,49,41,42,44,45,46,47,48,

%U 54,50,59,51,52,53,55,56,57,58,65,60,69,61,62,63,64,66,67,68,70,76,71

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

%H Reinhard Zumkeller, <a href="/A249591/b249591.txt">Table of n, a(n) for n = 1..10000</a>

%H E. Angelini, <a href="http://list.seqfan.eu/oldermail/seqfan/2014-November/013904.html">a(n) shows one of the digits of a(n-1)-1</a>, Nov 02 2014.

%o (PARI) {u=0; a=1; for(n=1, 99, print1(a","); u+=1<<a; D=Set(if(a>1,digits(a-1))); for(k=2, 9e9, bittest(u, k)&&next; #setintersect(D, Set(digits(k)))||next; a=k; break))}

%o (Haskell)

%o import Data.List (intersect, delete)

%o a249591 n = a249591_list !! (n-1)

%o a249591_list = 1 : f 1 [2..] where

%o f x zs = g zs where

%o g (y:ys) = if null $ show y `intersect` show (x - 1)

%o then g ys else y : f y (delete y zs)

%o -- _Reinhard Zumkeller_, Nov 02 2014

%Y Cf. A249585.

%Y Cf. A184992.

%K nonn,base

%O 1,2

%A _Eric Angelini_ and _M. F. Hasler_, Nov 01 2014

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 12:14 EDT 2024. Contains 371792 sequences. (Running on oeis4.)