A289287 Starting with a(1) = 1, a(n) = smallest nonnegative integer not yet in the sequence such that the last digit of a(n-1) plus the first digit of a(n) is equal to 9. The digit 0 is not allowed.
1, 8, 11, 81, 82, 7, 2, 71, 83, 6, 3, 61, 84, 5, 4, 51, 85, 41, 86, 31, 87, 21, 88, 12, 72, 73, 62, 74, 52, 75, 42, 76, 32, 77, 22, 78, 13, 63, 64, 53, 65, 43, 66, 33, 67, 23, 68, 14, 54, 55, 44, 56, 34, 57, 24, 58, 15, 45, 46, 35, 47, 25, 48, 16, 36, 37, 26, 38, 17, 27, 28, 18, 19
Offset: 1
Programs
-
Mathematica
Module[{a = {1}, k, d = 9}, TimeConstrained[Do[k = 2; While[Or[MemberQ[a, k], MemberQ[IntegerDigits@ k, 0], # != d] &[Mod[a[[n - 1]], 10] + First@ IntegerDigits@ k], k++]; AppendTo[a, k], {n, 2, 100}], 2]; a] (* Michael De Vlieger, Jul 14 2017 *)
Comments