login
A356465
The number of unit squares enclosed by the rectangular spiral of which the n-th side has length prime(n).
1
0, 2, 6, 12, 27, 59, 113, 179, 257, 359, 497, 747, 963, 1227, 1577, 1799, 2081, 2611, 3223, 3663, 4167, 4817, 5231, 5847, 6657, 7527, 8801, 9869, 10439, 11057, 11699, 12425, 14675, 16817, 18027, 19139, 20855, 22595, 23803, 25711, 27321, 29011, 31063, 32495
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.
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
Cf. A000040.
Sequence in context: A091919 A059078 A335712 * A166963 A188476 A155583
KEYWORD
nonn
AUTHOR
Bob Andriesse, Aug 08 2022
STATUS
approved