A248024 Lexicographically earliest permutation of the positive integers such that the first digit of a(n+1) divides a(n).
1, 10, 2, 11, 12, 3, 13, 14, 7, 15, 5, 16, 4, 17, 18, 6, 19, 100, 20, 21, 30, 22, 23, 101, 102, 24, 8, 25, 50, 26, 27, 9, 31, 103, 104, 28, 29, 105, 32, 40, 41, 106, 107, 108, 33, 34, 109, 110, 51, 35, 52, 42, 36, 37, 111, 38, 112, 43, 113, 114, 39, 115, 53, 116, 44, 45, 54, 60
Offset: 1
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
- Eric Angelini, Quick and fun permutation, SeqFan list, Sep 29 2014
- Index entries for sequences that are permutations of the natural numbers
Programs
-
Haskell
import Data.List (delete) a248024 n = a248024_list !! (n-1) a248024_list = 1 : f 1 [2..] where f x zs = g zs where g (y:ys) = if x `mod` (a000030 y) == 0 then y : f y (delete y zs) else g ys -- Reinhard Zumkeller, Sep 30 2014
-
Mathematica
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 *)
-
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<