[go: up one dir, main page]

login
a(n) is the smallest nonnegative integer not yet in the sequence that starts with the ending digit of a(n-1); a(1)=0; initial zeros are dropped.
1

%I #44 Jan 05 2020 00:40:14

%S 0,1,10,2,20,3,30,4,40,5,50,6,60,7,70,8,80,9,90,11,12,21,13,31,14,41,

%T 15,51,16,61,17,71,18,81,19,91,100,22,23,32,24,42,25,52,26,62,27,72,

%U 28,82,29,92,200,33,34,43,35,53,36,63,37,73,38,83,39,93,300,44,45,54

%N a(n) is the smallest nonnegative integer not yet in the sequence that starts with the ending digit of a(n-1); a(1)=0; initial zeros are dropped.

%C Theorem: Every nonnegative number appears.

%C Proof: (Sketched by _Enrique Navarrete_, Sep 25 2018; completed by _N. J. A. Sloane_, Oct 27 2018)

%C (i) Sequence is infinite (dG, G=giant number, is always available)

%C (ii) As usual for these "lexicographically earliest distinct term sequences", for any k, there is a threshold n_k such that for all n > n_k, a(n) > k.

%C (iii) Some final digit (d, say) appears infinitely often. (Otherwise sequence would be finite.) If d=0, go to step (vi).

%C (iv) All numbers beginning with d appear (If dm were missing, find xd in sequence which is > dm and also > n_{dm}. Then term after xd would be dm, contradiction.)

%C (v) In particular, all numbers dm0 appear.

%C (vi) After a number ending in 0, the next number is the smallest missing number. So if x is missing, find dm0 > n_x, then the next term would be (0)x = x, a contradiction. QED

%H Rémy Sigrist, <a href="/A319154/b319154.txt">Table of n, a(n) for n = 1..10000</a>

%e a(2) = 1 since it is formed from a(1) = 0 as 01 = 1.

%e a(20) = 11 since it is the smallest number not yet in the sequence that starts with the ending digit 0 of a(19) = 90.

%t Nest[Append[#, Block[{k = 1}, While[Nand[FreeQ[#, k], If[# == 0, True, First@ IntegerDigits@ k == #] &@ Mod[#[[-1]], 10]], k++]; k]] &, {0}, 69] (* _Michael De Vlieger_, Oct 15 2018 *)

%o (PARI) nexta(v, x) = {my(d = x % 10, newa); for (i=0, oo, newa = eval(concat(Str(d), Str(i))); if (! vecsearch(v, newa), return (newa)););}

%o lista(nn) = {lasta = 0; print1(lasta, ", "); va = [lasta]; for (n=1, nn, newa = nexta(va, lasta); print1(newa, ", "); va = vecsort(concat(va, newa)); lasta = newa;);} \\ _Michel Marcus_, Oct 15 2018

%Y Cf. A008592, A162501, A173237, A261370.

%K nonn,base,look,hear

%O 1,3

%A _Enrique Navarrete_, Sep 25 2018