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 A056943 #9 Jun 10 2025 16:25:47 %S A056943 0,0,0,1,2,1,3,5,4,3,6,9,8,7,6,10,14,13,12,11,10,15,20,19,18,17,16,15, %T A056943 21,27,26,25,24,23,22,21,28,35,34,33,32,31,30,29,28,36,44,43,42,41,40, %U A056943 39,38,37,36,45,54,53,52,51,50,49,48,47,46,45,55,65,64,63,62,61,60,59 %N A056943 Unused area of rectangle needed to enclose a non-touching spiral of length n on a square lattice. %F A056943 a(n) =floor[(sqrt(8n+1)-1)/2]*ceiling[(sqrt(8n+1)-1)/2]-n =A002024(n)*A003056(n)-n =A056942(n)-n =n-A056944(n). If n=t(t+1)/2 then a(n)=t(t-1)/2; if n=t(t+1)/2+k with 0<k <= t then a(n)=t(t+1)/2-k. %e A056943 a(9)=3 since spiral is as marked by 9 X's in 4*3=12 rectangle, with 12-9=3 spaces unused: %e A056943 X.XX %e A056943 X..X %e A056943 XXXX %t A056943 uar[n_]:=Module[{c=(Sqrt[8n+1]-1)/2},Floor[c]Ceiling[c]-n]; Array[ uar,80,0] (* _Harvey P. Dale_, Oct 29 2015 *) %o A056943 (Python) %o A056943 from math import isqrt %o A056943 def A056943(n): return (isqrt(n<<3)+1>>1)*((k:=isqrt(m:=n+1<<1))-((m>=k*(k+1)+1)^1))-n # _Chai Wah Wu_, Jun 10 2025 %Y A056943 Cf. A002024, A003056, A056942, A056944. %K A056943 easy,nonn %O A056943 0,5 %A A056943 _Henry Bottomley_, Jul 13 2000