OFFSET
1,2
COMMENTS
A simplified variation of A262282.
A permutation of the positive integers with inverse A262358;
It seems clear that every number will appear, but it would be nice to have a formal proof. - N. J. A. Sloane, Sep 20 2015
LINKS
MATHEMATICA
a[1] = 1; a[n_] := a[n] = Module[{s, k}, s = Rest[IntegerDigits[a[n - 1]]] //. {(0).., d__} :> {d}; For[k = 2, True, k++, If[FreeQ[Array[a, n - 1], k], If[s == {0}, Return[k], If[IntegerDigits[k][[1 ;; Length[s]]] == s, Return[k]]]]]];
Table[Print[n, " ", a[n]]; a[n], {n, 1, 100}] (* Jean-François Alcover, Mar 12 2019 *)
PROG
(Haskell)
import Data.List (isPrefixOf, delete, genericIndex)
import Data.Set (singleton, notMember, insert)
a262356 n = a262356_list !! (n-1)
a262356_list = 1 : f "" (singleton "1") where
f xs s = (read ys :: Int) : f (dropWhile (== '0') ys') (insert ys s)
where ys@(_:ys') = head
[vs | vs <- zss, isPrefixOf xs vs, notMember vs s]
zss = map show [2..]
CROSSREFS
KEYWORD
AUTHOR
Reinhard Zumkeller, Sep 19 2015
STATUS
approved