A056942 Area of rectangle needed to enclose a non-touching spiral of length n on a square lattice.
0, 1, 2, 4, 6, 6, 9, 12, 12, 12, 16, 20, 20, 20, 20, 25, 30, 30, 30, 30, 30, 36, 42, 42, 42, 42, 42, 42, 49, 56, 56, 56, 56, 56, 56, 56, 64, 72, 72, 72, 72, 72, 72, 72, 72, 81, 90, 90, 90, 90, 90, 90, 90, 90, 90, 100, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 121
Offset: 0
Examples
a(9) = 12 since spiral is as marked by 9 X's in 4*3 = 12 rectangle: X.XX X..X XXXX
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 0..10000
Programs
-
Haskell
a056942 n = a056942_list !! n a056942_list = concatMap (\x -> (x ^ 2) : (take x $ repeat (x * (x + 1)))) [0..] -- Reinhard Zumkeller, Feb 11 2014
-
Mathematica
ar[n_]:=Module[{c=(Sqrt[8n+1]-1)/2},Floor[c]Ceiling[c]]; Array[ar,70,0] (* Harvey P. Dale, Feb 27 2012 *)
-
Python
from math import isqrt def A056942(n): return (isqrt(n<<3)+1>>1)*((k:=isqrt(m:=n+1<<1))-((m>=k*(k+1)+1)^1)) # Chai Wah Wu, Jun 10 2025
Comments