login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A213088 The Manhattan distance to the origin while traversing the first quadrant in a taxicab geometry. 0
0, 1, 2, 1, 2, 3, 4, 3, 2, 3, 4, 5, 6, 5, 4, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 6, 7, 8, 9, 10, 11, 12, 11, 10, 9, 8, 7, 6, 7, 8, 9, 10, 11, 12, 13, 14, 13, 12, 11, 10, 9, 8, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 15, 14, 13, 12, 11 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,3

LINKS

Table of n, a(n) for n=1..78.

PROG

(Python)

def f(x, y):

    if not x and y % 2:

        y = y + 1

    elif not y and not x % 2:

        x = x + 1

    elif x == y:

        if x % 2:

            x = x - 1

        else:

            y = y - 1

    elif y < x:

        if x % 2:

            y = y + 1

        else:

            y = y - 1

    else:

        if y % 2:

            x = x - 1

        else:

            x = x + 1

    return x, y

res = []

x = y = 0

for i in range(100):

    res.append(str(x + y))

    x, y = f(x, y)

print ', '.join(res)

CROSSREFS

Sequence in context: A030307 A175792 A196686 * A169809 A214962 A076258

Adjacent sequences:  A213085 A213086 A213087 * A213089 A213090 A213091

KEYWORD

nonn,walk

AUTHOR

Jens Ahlström, Jun 05 2012

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

License Agreements, Terms of Use, Privacy Policy .

Last modified October 18 10:28 EDT 2017. Contains 293507 sequences.