A319154 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.
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, 15, 51, 16, 61, 17, 71, 18, 81, 19, 91, 100, 22, 23, 32, 24, 42, 25, 52, 26, 62, 27, 72, 28, 82, 29, 92, 200, 33, 34, 43, 35, 53, 36, 63, 37, 73, 38, 83, 39, 93, 300, 44, 45, 54
Offset: 1
Examples
a(2) = 1 since it is formed from a(1) = 0 as 01 = 1. 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.
Links
- Rémy Sigrist, Table of n, a(n) for n = 1..10000
Programs
-
Mathematica
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 *)
-
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)););} 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
Comments