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!)
A308619 Negative van Eck's sequence: For n >= 1, if there exists an m < n such that a(m) = a(n), take the largest such m and set a(n+1) = n-m, otherwise a(n+1) = -a(n). Start with a(1)=0. 1
0, 0, 1, -1, 1, 2, -2, 2, 2, 1, 5, -5, 5, 2, 5, 2, 2, 1, 8, -8, 8, 2, 5, 8, 3, -3, 3, 2, 6, -6, 6, 2, 4, -4, 4, 2, 4, 2, 2, 1, 22, -22, 22, 2, 5, 22, 3, 20, -20, 20, 2, 7, -7, 7, 2, 4, 19, -19, 19, 2, 5, 16, -16, 16, 2, 5, 5, 1, 28, -28, 28, 2, 7, 19, 15, -15, 15, 2, 6, 48, -48, 48, 2, 5, 17, -17, 17, 2, 5, 5, 1, 23, -23, 23, 2, 7, 23, 3, 51, -51 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,6
COMMENTS
Similar logic as van Eck's sequence except that if a(n) hasn't appeared before, then a(n+1) = -a(n) instead of being 0.
LINKS
FORMULA
If a(n) < 0, then a(n+1) = -a(n) and a(n+2) = 2. - Rémy Sigrist, Jul 14 2019
EXAMPLE
We start with a(1) = 0.
0 has not occurred before, so our rule says that a(2) = -a(1) = 0.
Now 0 has occurred before, at a(1), which is 1 term before, so a(3) = 1.
1 has not occurred before, so a(4) = -a(3) = -1.
-1 has not occurred before, so a(5) = -a(4) = 1.
Now 1 has occurred before, at a(3), which is 2 term before, so a(6) = 2.
2 has not occurred before, so a(6) = -a(5) = -2.
And so on...
PROG
(Python)
import numpy as np
def A308619(n):
NegVanEck = np.array([0])
#first value is 0
i=NegVanEck[0]
while i < n:
last = NegVanEck[-1]
pos = np.where(NegVanEck == last)
if pos[0].size == 1:
NegVanEck = np.append(NegVanEck, -last)
else:
NegVanEck = np.append(NegVanEck, pos[0][-1] - pos[0][-2])
i += 1
return NegVanEck
print(A308619(1000)) #prints first 1000 integers of the sequence
CROSSREFS
Cf. A181391.
Sequence in context: A064741 A281659 A345202 * A114294 A371929 A242050
KEYWORD
sign
AUTHOR
João D. R. Camacho, Jun 11 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 May 14 23:22 EDT 2024. Contains 372535 sequences. (Running on oeis4.)