OFFSET
1,2
COMMENTS
"a(n) ... makes the sequence extendable" means the name of a(n) does not start with any of the letters f and s.
EXAMPLE
38 is followed by 88 as 48, 58, 68 and 78 cannot make the sequence extendable.
MATHEMATICA
names = StringReplace[
IntegerName /@ Range[1000], {"\[Hyphen]" -> "", " " -> ""}];
lst = {1}; next[n_] := next[n] =
Module[{pos = Complement[Range[Length[names]], lst], i = 1},
While[
Or[
And[
First[Characters[names[[Last[lst]]]]] != Last[Characters[names[[pos[[i]]]]]],
pos[[i]] <= Length[names]
],
MemberQ[{"f", "s"}, First[Characters[names[[pos[[i]]]]]]] == True
],
i++
];
AppendTo[lst, pos[[i]]]
];
seq[n_] := Nest[next, 1, n]; seq[65]
CROSSREFS
KEYWORD
easy,nonn,word
AUTHOR
Ivan N. Ianakiev, Feb 20 2017
STATUS
approved