cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A335298 a(n) is the squared distance between the points P(n) and P(0) on a plane, n >= 0, such that the distance between P(n) and P(n+1) is n+1 and, going from P(n) to P(n+2), a 90-degree left turn is taken in P(n+1).

Original entry on oeis.org

0, 1, 5, 8, 8, 13, 25, 32, 32, 41, 61, 72, 72, 85, 113, 128, 128, 145, 181, 200, 200, 221, 265, 288, 288, 313, 365, 392, 392, 421, 481, 512, 512, 545, 613, 648, 648, 685, 761, 800, 800, 841, 925, 968, 968, 1013, 1105, 1152, 1152, 1201, 1301, 1352, 1352, 1405, 1513
Offset: 0

Views

Author

Gerhard Kirchner, Jun 28 2020

Keywords

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.

Examples

			  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
		

Crossrefs

Programs

  • 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 *)

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)