|
|
A331117
|
|
Lexicographically earliest sequence of distinct terms such that a(n+1) = a(n) + the largest odd digit of a(n), starting with a(n) = 1. If this addition is impossible, or if it leads to a term already in the sequence, restart the sequence from there with the smallest unused integer.
|
|
1
|
|
|
1, 2, 3, 6, 4, 5, 10, 11, 12, 13, 16, 17, 24, 7, 14, 15, 20, 8, 9, 18, 19, 28, 21, 22, 23, 26, 25, 30, 33, 36, 39, 48, 27, 34, 37, 44, 29, 38, 41, 42, 31, 32, 35, 40, 43, 46, 45, 50, 55, 60, 47, 54, 59, 68, 49, 58, 63, 66, 51, 56, 61, 62, 52, 57, 64, 53, 65, 70, 77, 84, 67, 74, 81, 82, 69, 78, 85, 90, 99, 108, 109
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
COMMENTS
|
This sequence is a permutation of the positive integers.
|
|
LINKS
|
|
|
EXAMPLE
|
a(1) = 1
a(2) = a(1) + 1 = 2;
as a(2) = 2 has no odd digit, we restart the sequence with a(3) = 3;
a(4) = a(3) + 3 = 6;
as a(4) = 6 has no odd digit, we restart the sequence with a(5) = 4;
as a(5) = 4 has no odd digit, we restart the sequence with a(6) = 5;
a(6) = a(5) + 5 = 10;
a(7) = a(6) + 1 = 11;
a(8) = a(7) + 1 = 12;
a(9) = a(8) + 1 = 13;
a(10) = a(9) + 3 = 16; etc.
|
|
MATHEMATICA
|
Nest[Append[#1, If[FreeQ[#1, #2], #2, Block[{k = 2}, While[! FreeQ[#1, k], k++]; k]] ] & @@ {#1, If[Length@ #2 > 0, #1[[-1]] + #2[[-1]], 1]} & @@ {#, Select[Union@ IntegerDigits[#[[-1]] ], OddQ]} &, {1}, 80] (* Michael De Vlieger, Jan 11 2020 *)
|
|
CROSSREFS
|
|
|
KEYWORD
|
base,nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|