OFFSET
0,3
COMMENTS
P(n) is a corner on a spiral like this:
* * * * * * * * * * * *
*
* * * * * * * * *
* * *
* * * * * * *
* * * * *
* * * * * *
* * * *
* * * * * * * *
* *
* * * * * * * * * *
If we interpret the pointer from P(0) to P(n) as a complex number z(n), the description of the spiral is short because a 90-degree left turn is a multiplication by i (imaginary unit) and the distance of P(n) from P(0) is abs(z(n))^2, see formula 1.
LINKS
Index entries for linear recurrences with constant coefficients, signature (3,-5,7,-7,5,-3,1).
FORMULA
a(n) = abs(z(n))^2 with
1) z(n) = z(n-1)+n*i^(n-1), z(0)=0. (recursive)
2) z(n) = i/2*(n*i^(n+1)-(n+1)*i^n+1). (explicit)
Without complex numbers for k >= 0:
a(4*k) = 8*k^2,
a(4*k+1) = 8*k^2+4*k+1,
a(4*k+2) = 8*k^2+12*k+5,
a(4*k+3) = 8*(k+1)^2.
From Stefano Spezia, Jun 28 2020: (Start)
G.f.: x*(1 + 2*x - 2*x^2 + 2*x^3 + x^4)/((1 - x)^3*(1 + x^2)^2).
a(n) = 3*a(n-1) - 5*a(n-2) + 7*a(n-3) - 7*a(n-4) + 5*a(n-5) - 3*a(n-6) + a(n-7) for n > 6. (End)
EXAMPLE
n n*i^(n-1) z(n) a(n)
------------------------------------
0 0 0 0
1 1 1 1
2 2i 1+2i 5 = 1^2 + 2^2
3 -3 -2+2i 8 = 2^2 + 2^2
4 -4i -2-2i 8
5 5 3-2i 13 = 3^2 + 2^2
6 6i 3+4i 25 = 3^2 + 4^2
MATHEMATICA
z[0]=0; z[n_]:=z[n-1]+n*I^(n-1); a[n_]:=z[n]*Conjugate[z[n]]; Array[a, 55, 0] (* Stefano Spezia, Jun 28 2020 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Gerhard Kirchner, Jun 28 2020
STATUS
approved