cp's OEIS Frontend

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.

A056944 Amount by which used area of rectangle needed to enclose a non-touching spiral of length n on a square lattice exceeds unused area.

This page as a plain text file.
%I A056944 #24 Jun 10 2025 16:26:06
%S A056944 0,1,2,2,2,4,3,2,4,6,4,2,4,6,8,5,2,4,6,8,10,6,2,4,6,8,10,12,7,2,4,6,8,
%T A056944 10,12,14,8,2,4,6,8,10,12,14,16,9,2,4,6,8,10,12,14,16,18,10,2,4,6,8,
%U A056944 10,12,14,16,18,20,11,2,4,6,8,10,12,14,16,18,20,22,12,2,4,6,8,10,12,14,16
%N A056944 Amount by which used area of rectangle needed to enclose a non-touching spiral of length n on a square lattice exceeds unused area.
%C A056944 m (when n is m-th triangular number) followed by m even numbers from 2 through 2m.
%H A056944 Vincenzo Librandi, <a href="/A056944/b056944.txt">Table of n, a(n) for n = 0..1000</a>
%F A056944 a(n) = 2n - floor((sqrt(8n+1)-1)/2)*ceiling((sqrt(8n+1)-1)/2) = 2n - A002024(n)*A003056(n) = 2n - A056942(n) = n -A056943(n). If n = t(t+1)/2 then a(n)=t; if n = t(t+1)/2+k with 0 < k <= t then a(n)=2k.
%e A056944 a(9)=6 since spiral is as marked by 9 X's in 4*3 = 12 rectangle, with 12-9 = 3 spaces unused and a used-unused difference of 9-3 = 6:
%e A056944 X.XX
%e A056944 X..X
%e A056944 XXXX
%e A056944 As a triangle, the first few rows are: 1; 2, 2; 2, 4, 3; 2, 4, 6, 4; 2, 4, 6, 8, 5; 2, 4, 6, 8, 10, 6; 2, 4, 6, 8, 10, 12, 7; ... (= reversal of triangle A143595). Row sums = n^2. - _Gary W. Adamson_, Aug 26 2008
%t A056944 uar[n_]:=Module[{c=(Sqrt[8n+1]-1)/2},2n-Floor[c]Ceiling[c]]; Array[uar,90,0] (* _Harvey P. Dale_, Aug 14 2013 *)
%o A056944 (Magma) [2*n-Floor((Sqrt(8*n+1)-1)/2)*Ceiling((Sqrt(8*n+1)-1)/2): n in [0..90]]; // _Vincenzo Librandi_, Aug 06 2017
%o A056944 (Python)
%o A056944 from math import isqrt
%o A056944 def A056944(n): return (n<<1)-(isqrt(n<<3)+1>>1)*((k:=isqrt(m:=n+1<<1))-((m>=k*(k+1)+1)^1)) # _Chai Wah Wu_, Jun 10 2025
%Y A056944 Cf. A002024, A003056, A056942, A056943.
%Y A056944 Cf. A143595. - _Gary W. Adamson_, Aug 26 2008
%K A056944 easy,nonn,nice
%O A056944 0,3
%A A056944 _Henry Bottomley_, Jul 13 2000