%I A095115
%S A095115 1,3,7,12,18,10,19,30,17,31,16,36,57,35,58,34,59,33,60,32,61,98,136,97,
%T A095115 137,96,54
%N A095115 a(1)=1. Given a(1),...,a(n-1), 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}.
%H A095115 Leroy Quet, <a href="http://www.prism-of-spirals.net/">Home Page</a>
(listed in lieu of email address)
%e A095115 For n=5, S={1,3,7,12, 2,4,5} so d=6. a(4)-d=6 is in S union {6}, so we
have a(5)=a(4)+d=18.
%e A095115 a(28) does not exist: d=43, but both a(28)-43=11 and a(28)+43=97 are
in S union {43}.
%t A095115 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]]
%Y A095115 Sequence in context: A084582 A072098 A140778 this_sequence A141214 A027379
A055998
%Y A095115 Adjacent sequences: A095112 A095113 A095114 this_sequence A095116 A095117
A095118
%K A095115 nonn,fini,full
%O A095115 1,2
%A A095115 Dean Hickerson (dean.hickerson(AT)yahoo.com), following a suggestion
of Leroy Quet May 28 2004
|