The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A309764 a(0)=0; for n > 0, a(n) = a(n-1) + d * n, where initially d = 1 but changes sign whenever n = |a(k)|, 0 < k < n. 1
0, 1, 3, 0, -4, -9, -15, -22, -30, -21, -11, -22, -34, -47, -61, -46, -30, -13, 5, 24, 44, 23, 45, 22, 46, 71, 97, 124, 152, 181, 151, 120, 88, 55, 89, 124, 160, 197, 235, 274, 314, 355, 397, 440, 396, 441, 395, 442, 490, 539, 589, 640, 692, 745, 799, 744, 688, 631, 573, 514 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
COMMENTS
The sequence oscillates erratically from above to below zero. For n <= 10^9 it changes sign 1823 times, with the longest gap between changes occurring from n = 312214179 to n = 703640490, a run of 391426311 negative values. The maximum run without d changing sign starts at n = 726820728 and goes for 43207 values. The longest run of consecutive sign changes in d is four, which occurs four times, at n = 21, 44, 395, and 439. In total d changes sign 675277 times. The largest positive a(n) is for n = 765504445 with a(n) = 496154732190565. The largest negative a(n) is for n = 951481398 with a(n) = -618690200847941.
LINKS
EXAMPLE
a(2) = 3, d = 1. For n = 3 as n = |a(2)|, d changes to d = -1. Therefore a(3) = a(2) + d * 3 = 0.
a(8) = -30, d = -1, and a(5) = -9. For n = 9 as n = |a(5)|, d changes to d = 1. Therefore a(9) = a(8) + d * 9 = -21.
MATHEMATICA
s = {0}; d = 1; Do[d *= If[MemberQ[s, n] || MemberQ[s, -n], -1, 1]; AppendTo[s, s[[-1]] + d*n], {n, 1, 60}]; s (* Amiram Eldar, Aug 16 2019 *)
PROG
(PARI) s=0; v=0; d=1; for (n=1, mx=60, print1 (v, ", "); if (bittest(s, n), d=-d); v+=d*n; w=abs(v); if (w<=mx, s=bitor(s, 2^w))) \\ Rémy Sigrist, Aug 16 2019
CROSSREFS
Sequence in context: A330420 A072329 A068630 * A079406 A068627 A357884
KEYWORD
sign
AUTHOR
Scott R. Shannon, Aug 15 2019
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified June 5 10:42 EDT 2024. Contains 373105 sequences. (Running on oeis4.)