login
This site is supported by donations 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

Table of n, a(n) for n=0..75.

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

Cf. A228474, A324660-A324692.

Sequence in context: A037835 A116433 A106509 * A228110 A255175 A196199

Adjacent sequences:  A324689 A324690 A324691 * A324694 A324695 A324696

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 | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 23:48 EDT 2019. Contains 322465 sequences. (Running on oeis4.)