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!)
A262356 a(1) = 1; for n > 1, let s denote the digit-string of a(n-1) with the first digit omitted. Then a(n) is the smallest number not yet present which starts with s, omitting leading zeros. 9

%I #22 Mar 12 2019 07:19:40

%S 1,2,3,4,5,6,7,8,9,10,11,12,20,13,30,14,40,15,50,16,60,17,70,18,80,19,

%T 90,21,100,22,23,31,101,102,24,41,103,32,25,51,104,42,26,61,105,52,27,

%U 71,106,62,28,81,107,72,29,91,108,82,200,33,34,43,35,53

%N a(1) = 1; for n > 1, let s denote the digit-string of a(n-1) with the first digit omitted. Then a(n) is the smallest number not yet present which starts with s, omitting leading zeros.

%C A simplified variation of A262282.

%C A permutation of the positive integers with inverse A262358;

%C A262363 and A262371 give the primes and where they occur: A262363(n)=a(A262371(n)).

%C a(A262393(n)) = A262390(n).

%C 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

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

%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] = 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]]]]]];

%t Table[Print[n, " ", a[n]]; a[n], {n, 1, 100}] (* _Jean-François Alcover_, Mar 12 2019 *)

%o (Haskell)

%o import Data.List (isPrefixOf, delete, genericIndex)

%o import Data.Set (singleton, notMember, insert)

%o a262356 n = a262356_list !! (n-1)

%o a262356_list = 1 : f "" (singleton "1") where

%o f xs s = (read ys :: Int) : f (dropWhile (== '0') ys') (insert ys s)

%o where ys@(_:ys') = head

%o [vs | vs <- zss, isPrefixOf xs vs, notMember vs s]

%o zss = map show [2..]

%Y Cf. A262283, A262282, A262358 (inverse), A262360 (fixed points), A262374 (binary counterpart), A262363 (primes), A262371, A000030, A262390 (starting with 1), A262393.

%K nonn,base,look

%O 1,2

%A _Reinhard Zumkeller_, Sep 19 2015

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 23 10:07 EDT 2024. Contains 371905 sequences. (Running on oeis4.)