editing
approved
editing
approved
Cf. A005228.
approved
editing
editing
approved
a(1)=1. Given a(1),...,a(n-1), to find a(n), let S = {a(1), ..., a(n-1), |a(2)-a(1)|, ..., |a(n-1)-a(n-2)|}. Let d be the smallest positive integer not in S. Then a(n) is the smallest one of a(n-1)-d and a(n-1)+d which is a positive integer not in S union {d}.
approved
editing
_Dean Hickerson (dean.hickerson(AT)yahoo.com), _, following a suggestion of Leroy Quet, May 28 2004
Dean Hickerson (dean.hickerson(AT)yahoo.com), following a suggestion of Leroy Quet , May 28 2004
Dean Hickerson (dean.hickerson(AT)yahoo.com), following a suggestion of _Leroy Quet _ May 28 2004
Leroy Quet, <a href="http://www.prism-of-spirals.net/">Home Page</a> (listed in lieu of email address)
nonn,fini,full,new
Leroy Quet, <a href="http://www.prism-of-spirals.net/">Home Page</a> (listed in lieu of email address)
nonn,fini,full,new
Dean Hickerson (dean.hickerson(AT)math.ucdavisyahoo.educom), following a suggestion of Leroy Quet (qq-quet(AT)mindspring.com), May 28 2004
mex1[s_]:=Module[{n}, For[n=1, MemberQ[s, n], n++, Null]; n]; a[1]=1; a[n_]:=a[n]=Module[{as, d}, as=a/@Range[n-1]; as=Union[as, Abs[Drop[as, 1]-Drop[as, -1]]]; AppendTo[as, d=mex1[as]]; If[a[n-1]-d>0&&!MemberQ[as, a[n-1]-d], a[n-1]-d, If[ !MemberQ[as, a[n-1]+d], a[n-1]+d], False]]
nonn,fini,full,new