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.
%I A056942 #15 Jun 10 2025 16:25:42 %S A056942 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, %T A056942 42,42,42,49,56,56,56,56,56,56,56,64,72,72,72,72,72,72,72,72,81,90,90, %U A056942 90,90,90,90,90,90,90,100,110,110,110,110,110,110,110,110,110,110,121 %N A056942 Area of rectangle needed to enclose a non-touching spiral of length n on a square lattice. %C A056942 m^2 (when n is m-th triangular number) followed by m copies of m-th pronic [m(m+1)]. %H A056942 Reinhard Zumkeller, <a href="/A056942/b056942.txt">Table of n, a(n) for n = 0..10000</a> %F A056942 a(n) = floor[(sqrt(8n+1)-1)/2]*ceiling[(sqrt(8n+1)-1)/2] = A002024(n)*A003056(n) = A056943(n)+n = 2n-A056944(n). If n = t(t+1)/2 then a(n) = t^2; if t(t-1)/2 < n < t(t+1)/2 then a(n) = t(t-1). %e A056942 a(9) = 12 since spiral is as marked by 9 X's in 4*3 = 12 rectangle: %e A056942 X.XX %e A056942 X..X %e A056942 XXXX %t A056942 ar[n_]:=Module[{c=(Sqrt[8n+1]-1)/2},Floor[c]Ceiling[c]]; Array[ar,70,0] (* _Harvey P. Dale_, Feb 27 2012 *) %o A056942 (Haskell) %o A056942 a056942 n = a056942_list !! n %o A056942 a056942_list = concatMap %o A056942 (\x -> (x ^ 2) : (take x $ repeat (x * (x + 1)))) [0..] %o A056942 -- _Reinhard Zumkeller_, Feb 11 2014 %o A056942 (Python) %o A056942 from math import isqrt %o A056942 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 %Y A056942 Cf. A000217, A000290, A002024, A002378, A002620, A003056, A038759, A056943, A056944. %K A056942 easy,nice,nonn %O A056942 0,3 %A A056942 _Henry Bottomley_, Jul 13 2000