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!)
A324692 a(n) = partial sums of A324672. 33
0, 0, 1, 0, 1, 0, -1, 0, 1, 0, -1, 0, 1, 0, -1, -2, -1, 0, -1, -2, -3, -2, -1, 0, -1, -2, -1, -2, -3, -2, -1, 0, 1, 2, 3, 4, 3, 4, 5, 4, 3, 4, 3, 2, 1, 0, 1, 0, 1, 2, 1, 0, 1, 0, -1, -2, -1, 0, 1, 2, 1, 0, -1, -2, -3, -4, -5, -4, -5, -6, -7, -6, -5, -4, -3, -2 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,16
LINKS
David Nacin, A324692
PROG
(Python)
import functools
#Sequences A324660-A324691 generated by manipulating this trip function
#spots - positions in order with possible repetition
#flee - positions from which we move away from zero with possible repetition
#stuck - positions from which we move to a spot already visited with possible repetition
def trip(n):
stucklist = list()
spotsvisited = [n]
leavingspots = list()
turn = 0
forbidden = {n}
while n != 0:
turn += 1
sign = n // abs(n)
st = sign * turn
if n - st not in forbidden:
n = n - st
else:
leavingspots.append(n)
if n + st in forbidden:
stucklist.append(n)
n = n + st
spotsvisited.append(n)
forbidden.add(n)
return {'stuck':stucklist, 'spots':spotsvisited,
'turns':turn, 'flee':leavingspots}
def sgn(x):
if x:
return x//abs(x)
return 0
@functools.lru_cache(maxsize=None)
def A324672(n):
d = trip(n)
mx=max([i for i in d['spots']])
mn=min([i for i in d['spots']])
return sgn(mx+mn)
#Actual sequence
def a(n):
return sum(A324672(i) for i in range(n))
CROSSREFS
Sequence in context: A116433 A360099 A106509 * A228110 A329116 A255175
KEYWORD
sign
AUTHOR
David Nacin, Mar 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 March 29 11:14 EDT 2024. Contains 371278 sequences. (Running on oeis4.)