OFFSET
0,3
LINKS
James C. McMahon, Table of n, a(n) for n = 0..10000
EXAMPLE
a(4) = 10 because subtracting 4 from the previous term (6) would give 2, which is smaller than 4, so add 4 to 6 to get 10.
a(6) = 9 because subtracting 6 from the previous term (15) gives 9, which is bigger than 6, and has not appeared before.
a(9) = 33 because subtracting 9 from the previous term (24) gives 15, which is bigger than 9, but has appeared before, so add 9 to 24 to get 33.
MATHEMATICA
s={0}; Do[If [s[[-1]]>2n&&!MemberQ[s, s[[-1]]-n], AppendTo[s, s[[-1]]-n], AppendTo[s, s[[-1]]+n]], {n, 60}]; s (* James C. McMahon, Sep 21 2025 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Kelvin Voskuijl, Sep 05 2025
STATUS
approved
