OFFSET
0,2
COMMENTS
The pictures in the links show how the spiral is constructed. The first segment is the small black rectangle in the center, of which the left lower corner is at the origin (0,0). It represents prime(1) = 2 (its width) and is given a height of one. The first part of the boundary of the spiral is the line between (0,0) and (2,0). Prime(2) = 3 yields the next part of the boundary, the line connecting (2,0) and (2,3). The next primes determine how many unit steps the boundary of the spiral goes left, down, right, up, etc.
LINKS
FORMULA
a(n) = a(n-1) +(prime(n) - prime(n-2) + prime(n-4))*(prime(n-1) - prime(n-3)) for n > 4.
MATHEMATICA
a[4]:=27; a[n_]:=a[n]=a[n-1]+(Prime[n]-Prime[n-2]+Prime[n-4])(Prime[n-1]-Prime[n-3]); Join[{0, 2, 6, 12, 27}, Table[a[n], {n, 5, 45}]] (* Stefano Spezia, Aug 09 2022 *)
PROG
(Python)
from sympy import prime as p
a = [0, 2, 6, 12, 27] #first 4 area values
area = 27
for n in range(5, 44+1):
darea = (p(n) - p(n-2) + p(n-4)) * (p(n-1) - p(n-3))
area += darea
a.append(area)
print('a(n)=', a)
CROSSREFS
KEYWORD
nonn
AUTHOR
Bob Andriesse, Aug 08 2022
STATUS
approved