%I #17 Jan 03 2024 17:19:02
%S 2,8,21,36,64,90,120,157,208,256,306,360,432,504,576,650,750,832,928,
%T 1025,1122,1254,1360,1480,1612,1748,1886,2016,2170,2328,2484,2646,
%U 2802,3000,3180,3348,3540,3718,3944,4148,4340,4552,4788,5016,5244,5473,5718,5964
%N Largest area (doubled) of a triangle enclosed by a circle of radius n such that the center of the circle and the vertices of the triangle all have integer coordinates.
%C "Enclosing" means that all vertices are located on or inside the circle. (0,0) is the center of the circle. The area of a "grid triangle" with integer vertex coordinates is a multiple of 1/2. The vertices of any largest triangle are "close points", i.e., points (x,y) on or inside the circle such that at least two of the four points (x+-1,y+-1) are located outside (see link).
%C There are terms b(n) and c(n) with b(n) <= a(n) <= c(n), see formula section. For any n, a triangle with the doubled area b(n) exists. By checking b(n)=c(n), one obtains:
%C a( 1) = 2
%C a( 5) = 64
%C a( 17) = 750
%C a( 65) = 10976
%C a( 241) = 150898
%C a( 901) = 2109120
%C a( 3361) = 29348702
%C a( 12545) = 408877504
%C a( 46817) = 5694545250
%C a(174725) = 79316215616
%C a(652081) = 1104727025998
%C The sequence of indices is A120893.
%H Gerhard Kirchner, <a href="/A358681/a358681.pdf">Examples and algorithm</a>
%F Limits: b(n) <= a(n) <= c(n) with
%F c(n) = floor(n ^ 2 * sqrt(3) * 3 / 2).
%F With f(n,t) = (3*n + t) * floor(sqrt((3*n + t) * (n - t)) / 2):
%F b(n) = f(n,0) for even n
%F b(n) = max{f(n,-1),f(n,1)} for odd n.
%F a(n)/n^2 tends to sqrt(3) * 3 / 2.
%e see link
%o (Maxima)
%o block(nmax: 50, a: makelist(0,i,1,nmax),
%o for n from 1 thru nmax do
%o (p: floor(n/sqrt(2)), if 2*p*(p+1) > n^2-1 then d:0 else d:1,
%o k0:n+1-d-p, z:2*k0-2+d,
%o v: makelist([0,0],i,1,4*z), ma:0,
%o /*Find close points with y>=0, x<=y:*/
%o for k from 1 thru k0 do (j:k-1, v[k][2]:n-j, v[k][1]: floor(sqrt(j*(2*n-j)))),
%o /*mirror x=y:*/
%o for k from k0+d thru z+1 do(j:z+2-k, v[k][1]: v[j][2], v[k][2]: v[j][1]),
%o /*rotation 90°:*/
%o for k from z+2 thru 4*z do(j:k-z, v[k][1]: v[j][2], v[k][2]: -v[j][1]),
%o /*All 4*z close points found, generate triangles:*/
%o for k from 1 thru k0 do
%o for j from k+2*z+1 thru k+3*z do
%o for m from k+z thru k+2*z-1 do
%o (ar:(v[j][1]-v[k][1])*(v[m][2]-v[k][2])-(v[j][2]-v[k][2])*(v[m][1]-v[k][1]),
%o if ar>ma then ma:ar), a[n]:ma), a);
%Y Cf. A358465, A120893.
%K nonn
%O 1,1
%A _Gerhard Kirchner_, Nov 26 2022