OFFSET
0,7
LINKS
Rémy Sigrist, Table of n, a(n) for n = 0..10101
Rémy Sigrist, PARI program for A340944
FORMULA
EXAMPLE
The spiral starts as follows:
+-----+-----+-----+-----+
|7 6 5 4 |3 .
| | .
+ +-----+-----+ + +
|8 | | |2 |
| | | | |
+ + +-----+-----+ +
|9 | | |0 1 |
| | | | | .
+ + + +-----+-----+ .
|10 | | .
| | | .
+ + +-----+-----+-----+-----+
.11 .
.
- so a(0) = a(4) = 0,
a(1) = a(2) = a(3) = 1,
a(5) = -1,
a(6) = -2,
a(7) = a(8) = a(9) = a(10) = a(11) = -3.
PROG
(PARI) See Links section.
(PARI) a(n) = my(r, s=sqrtint(n, &r)); if(r>s, s++; r-=2*s-1); real((r-s*I)*I^s); \\ Kevin Ryde, May 24 2023
CROSSREFS
KEYWORD
AUTHOR
Rémy Sigrist, Jan 30 2021
STATUS
approved