[go: up one dir, main page]

login
A306886
Number of distinct nonzero values taken by (x1-x2)^2 + (y1-y2)^2 for x1, y1, x2, y2 integers with 0 <= (x1,y1) <= n and -n <= (x2,y2) <= 0.
0
0, 5, 14, 26, 41, 60, 82, 105, 134, 164, 197, 234, 272, 314, 359, 407, 456, 507, 566, 623, 686, 748, 812, 883, 956, 1030, 1107, 1181, 1267, 1354, 1445, 1529, 1620, 1721, 1814, 1920, 2022, 2121, 2232, 2344, 2460, 2573, 2691, 2815, 2936, 3061, 3189, 3321, 3462
OFFSET
0,2
COMMENTS
In the x-y plane, lengths of line segments between lattice points P1=(x1,y1) with 0 <= (x1,y1) <= n and lattice points P2=(x2,y2) with -n <= (x2,y2) <= 0.
EXAMPLE
For n=1, distances P1 to P2 can take 5 distinct nonzero values, whose squared distances are {1,2,4,5,8}, so a(1)=5.
MAPLE
segments := proc (n)
local rr, x1, y1, x2, y2, sqDist;
rr := {};
for x1 from 0 to n do for y1 from 0 to n do
for x2 from 0 by -1 to -n do for y2 from 0 by -1 to -n do
sqDist := (x1-x2)^2+(y1-y2)^2;
if 0 < sqDist then rr := {op(rr), sqDist} end if;
end do end do
end do end do;
return rr
end proc:
qq:=[seq(nops(segments(n)), n=0..20)]
CROSSREFS
Sequence in context: A375289 A070133 A246517 * A202821 A301689 A367690
KEYWORD
nonn
AUTHOR
César Eliud Lozada, Mar 15 2019
EXTENSIONS
a(31)-a(48) from Jon E. Schoenfield, Apr 03 2019
STATUS
approved