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(5) = 5 because subtracting 5 from the previous term (10) gives 5, which is equal to a(n), and has not appeared before.
a(8) = 18 because subtracting 8 from the previous term (18) gives 10, which has appeared before, so add 8 to 18 to get 26.
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 15 2025 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Kelvin Voskuijl, Sep 05 2025
STATUS
approved
