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!)
A090928 Permutation of natural numbers arising from a square spiral. 6
1, 6, 7, 8, 9, 2, 3, 4, 5, 18, 19, 20, 21, 22, 23, 24, 25, 10, 11, 12, 13, 14, 15, 16, 17, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 50, 51, 52, 53, 54, 55, 56 (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 counterclockwise spiral: 1 -> 6 -> 7 -> 8 -> 9 -> 2 -> 3 -> 4 -> 5 -> 18 -> etc.
LINKS
MATHEMATICA
With[{x = Floor[(Floor[Sqrt[n-1]]+1)/2]}, Table[If[n +4*x <= (2*x+1)^2, n+4*x, n-4*x], {n, 1, 75}]] (* G. C. Greubel, Feb 05 2019 *)
PROG
(Sage)
def a(n):
x = (isqrt(n-1)+1)//2
return n + 4*x if n + 4*x <= (2*x+1)^2 else n - 4*x
[a(n) for n in (1..75)] # Eric M. Schmidt, May 18 2016
(PARI) {s(n) = ((sqrtint(n-1)+1)/2)\1};
for(n=1, 75, print1(if(n+4*s(n) <= (2*s(n)+1)^2, n +4*s(n), n - 4*s(n)), ", ")) \\ G. C. Greubel, Feb 05 2019
CROSSREFS
Sequence in context: A202703 A308147 A308165 * A199174 A335094 A153604
KEYWORD
easy,nonn
AUTHOR
Felix Tubiana, Feb 26 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 | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 01:35 EDT 2024. Contains 371964 sequences. (Running on oeis4.)