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

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A090861 Permutation of natural numbers arising from a spiral. 13
1, 6, 5, 4, 3, 2, 9, 8, 7, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 25, 24, 23, 22, 21, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 49, 48, 47, 46, 45, 44, 43, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,2

COMMENTS

Write out the natural numbers in a square counterclockwise spiral:

.

  17--16--15--14--13

   |               |

  18   5---4---3  12

   |   |       |   |

  19   6   1---2  11

   |   |           |

  20   7---8---9--10

   |

  21--22--23--24--25

.

Now read off the numbers in a clockwise spiral: 1 -> 6 -> 5 -> 4 -> 3 -> 2 -> 9 -> etc.

LINKS

Eric M. Schmidt, Table of n, a(n) for n = 1..1000

MATHEMATICA

With[{x = Floor[(Floor[Sqrt[n-1]]+1)/2]}, Table[8*x^2-n+2 +x*If[n <= 4*x^2+2*x, -2, 6], {n, 1, 75}]] (* G. C. Greubel, Feb 05 2019 *)

PROG

(Sage)

def a(n):

    x = (isqrt(n-1)+1)//2

    return 8*x^2 + (-2 if n <= 4*x^2 + 2*x else 6)*x + 2 - n

[a(n) for n in (1..75)] # Eric M. Schmidt, May 18 2016

(PARI) {s(n)=floor((floor(sqrt(n-1)) +1)/2)};

for(n=1, 75, print1(8*s(n)^2 -n +2 +s(n)*if(n<= 2*s(n)*(2*s(n)+1), -2, 6), ", ")) \\ G. C. Greubel, Feb 05 2019

CROSSREFS

Cf. A020703, A090915, A090925, A090928, A090929, A090930.

Sequence in context: A031056 A226293 A055117 * A132670 A221217 A018868

Adjacent sequences:  A090858 A090859 A090860 * A090862 A090863 A090864

KEYWORD

easy,nonn

AUTHOR

Felix Tubiana (fat2(AT)columbia.edu), Feb 16 2004

EXTENSIONS

Offset corrected by Eric M. Schmidt, May 18 2016

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 July 9 00:55 EDT 2020. Contains 335537 sequences. (Running on oeis4.)