login
A357301
a(n) is the number of distinct radii of circles passing through at least three points in a square grid of n X n points.
2
0, 1, 7, 19, 48, 112, 212, 383, 641, 988, 1523, 2250, 3103, 4364, 5831, 7696, 9985, 12945, 16164, 20246, 24946, 30145, 36385, 43839, 51752, 61610, 72475, 84273, 97231, 112733, 129111, 148178, 168585, 190609, 215549, 242392, 270459, 303510, 338324, 375848, 416522
OFFSET
1,3
COMMENTS
Proposed by Ed Pegg Jr in Mathematics StackExchange question 273348, where terms up to 212 were given, see link.
LINKS
Mathematics StackExchange, Number of circles in configuration, comment by Ed Pegg, Jan 09, 2013.
EXAMPLE
a(2) = 1: only one possible circle with squared radius 1/2;
a(3) = 7: squared radii of possible circles are {1, 2, 1/2, 5/2, 5/4, 25/16, 25/18}.
PROG
(PARI) \\ Function r2 determined using Mathematica
\\ (ArcLength [CircleThrough[{{x1, y1}, {x2, y2}, {x3, y3}}]]/(2*Pi))^2
radii(n) = {my (R=List(), r2(x1, y1, x2, y2, x3, y3) = ((x3 + (x2^2*y1 - x3^2*y1 - x1^2*y2 + x3^2*y2 - y1^2*y2 + y1*y2^2 + x1^2*y3 - x2^2*y3 + y1^2*y3 - y2^2*y3 - y1*y3^2 + y2*y3^2)/(2*(-x2*y1 + x3*y1 + x1*y2 - x3*y2 - x1*y3 + x2*y3)))^2 + (y3 - (-2*(x2 - x3)*(x1^2 - x3^2 + y1^2 - y3^2) + 2*(x1 - x3)*(x2^2 - x3^2 + y2^2 - y3^2))/(-4*x2*y1 + 4*x3*y1 + 4*x1*y2 - 4*x3*y2 - 4*x1*y3 + 4*x2*y3))^2)); for(x1=1, n, for(y1=1, n, for(x2=1, x1, for(y2=1, n, for(x3=1, x2, for(y3=1, n,
my (ax2=2*(x2-x1), ay2=2*(y2-y1), ax3=2*(x3-x1), ay3=2*(y3-y1), den=ax2*ay3 -ax3*ay2); if (den==0, next); listput (R, r2(x1, y1, x2, y2, x3, y3)))))))); Set(R)};
for (k=1, 15, print1(#radii(k), ", "))
(Python)
# after Hugo Pfoertner's PARI code
from math import gcd
from itertools import product
from sympy.utilities.iterables import combinations_with_replacement
def A357301(n):
c, t = set(), 0
for x1, x2, x3 in combinations_with_replacement(range(1, n+1), 3):
for y1, y2, y3 in product(range(1, n+1), repeat=3):
den = (x1-x2)*(y1-y3)-(x1-x3)*(y1-y2)<<2
if den:
x = ((x1-x2)**2+(y1-y2)**2)*((x1-x3)**2+(y1-y3)**2)*((x2-x3)**2+(y2-y3)**2)
y = (x1*(y2-y3)-x2*(y1-y3)+x3*(y1-y2))**2<<2
gc = gcd(x, y)
x //= gc
y //= gc
if (r:=(x, y)) not in c:
c.add(r)
t += 1
return t # Chai Wah Wu, Nov 30 2025
CROSSREFS
KEYWORD
nonn
AUTHOR
Hugo Pfoertner, Sep 23 2022, following a suggestion by Ed Pegg Jr, Jan 09 2013
EXTENSIONS
a(31)-a(41) from Chai Wah Wu, Nov 30 2025
STATUS
approved