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!)
A248024 Lexicographically earliest permutation of the positive integers such that the first digit of a(n+1) divides a(n). 5

%I #24 May 18 2023 23:49:09

%S 1,10,2,11,12,3,13,14,7,15,5,16,4,17,18,6,19,100,20,21,30,22,23,101,

%T 102,24,8,25,50,26,27,9,31,103,104,28,29,105,32,40,41,106,107,108,33,

%U 34,109,110,51,35,52,42,36,37,111,38,112,43,113,114,39,115,53,116,44,45,54,60

%N Lexicographically earliest permutation of the positive integers such that the first digit of a(n+1) divides a(n).

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

%H Eric Angelini, <a href="http://list.seqfan.eu/oldermail/seqfan/2014-September/013710.html">Quick and fun permutation</a>, SeqFan list, Sep 29 2014

%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>

%t a[1] = 1; a[n_] := a[n] = Block[{k = 2}, While[Mod[a[n - 1], First@IntegerDigits[k]] != 0 || MemberQ[Array[a, n - 1], k], k++]; k]; Array[a, 68] (* _Giorgos Kalogeropoulos_, May 12 2023 *)

%o (PARI) a(n,S=1,u=2)=for(i=1,n,print1(S",");for(k=1,9e9,bittest(u,k)&&next;S%digits(k)[1]&&next;u+=1<<S=k;break));S

%o (Haskell)

%o import Data.List (delete)

%o a248024 n = a248024_list !! (n-1)

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

%o f x zs = g zs where

%o g (y:ys) = if x `mod` (a000030 y) == 0

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

%o -- _Reinhard Zumkeller_, Sep 30 2014

%Y Cf. A248043 (inverse), A000030.

%K nonn,base,look

%O 1,2

%A _Eric Angelini_ and _M. F. Hasler_, Sep 29 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 16:52 EDT 2024. Contains 371794 sequences. (Running on oeis4.)