login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 56th year, we are closing in on 350,000 sequences, and we’ve crossed 9,700 citations (which often say “discovered thanks to the OEIS”).

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A235913 a(n) is the Manhattan distance between n^3 and (n+1)^3 in a square spiral of positive integers with 1 at the center. 0
1, 3, 11, 15, 13, 9, 5, 21, 33, 59, 71, 49, 47, 35, 15, 13, 43, 73, 109, 123, 117, 109, 167, 141, 113, 77, 43, 5, 51, 95, 145, 201, 263, 281, 397, 413, 317, 333, 269, 239, 183, 121, 63, 11, 81, 147, 219, 307, 379, 471, 567, 623, 517, 569, 683, 503, 545, 473, 395, 311 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,2

COMMENTS

Spiral begins:

.

  49  26--27--28--29--30--31

   |   |                   |

  48  25  10--11--12--13  32

   |   |   |           |   |

  47  24   9   2---3  14  33

   |   |   |   |   |   |   |

  46  23   8   1   4  15  34

   |   |   |       |   |   |

  45  22   7---6---5  16  35

   |   |               |   |

  44  21--20--19--18--17  36

   |                       |

  43--42--41--40--39--38--37

LINKS

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

EXAMPLE

Manhattan distance between 2^3=8 and 3^3=27 is 3 in a square spiral, so a(2)=3.

PROG

(Python)

import math

def get_x_y(n):

  sr = int(math.sqrt(n-1))  # Ok for small n's

  sr = sr-1+(sr&1)

  rm = n-sr*sr

  d = (sr+1)/2

  if rm<=sr+1:

     return -d+rm, d

  if rm<=sr*2+2:

     return d, d-(rm-(sr+1))

  if rm<=sr*3+3:

     return d-(rm-(sr*2+2)), -d

  return -d, -d+rm-(sr*3+3)

for n in range(1, 77):

  x0, y0 = get_x_y(n**3)

  x1, y1 = get_x_y((n+1)**3)

  print str(abs(x1-x0)+abs(y1-y0))+', ',

CROSSREFS

Cf. A214526, A232113, A232114, A232115.

Sequence in context: A273869 A289049 A288980 * A132363 A134629 A245522

Adjacent sequences:  A235910 A235911 A235912 * A235914 A235915 A235916

KEYWORD

nonn

AUTHOR

Alex Ratushnyak, Jan 16 2014

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 December 6 19:30 EST 2021. Contains 349567 sequences. (Running on oeis4.)