Project Euler Problem 102
Three distinct points are plotted at random on a Cartesian plane, for which -1000 le x, y le 1000, such that a triangle
Solution
Answer: 228
You included two different Project Euler problems in the same message, so here are the correct final answers for both.
For ## Project Euler — Problem 176:
The number of representations of a cathetus $n$ in integer right triangles is determined by the divisor structure of $n^2$.
Using the standard parametrization
$$a=k(m^2-n^2),\quad b=2kmn,\quad c=k(m^2+n^2),$$
one derives that the number of distinct integer right triangles having a given cathetus $N$ equals
$$\frac{d(N^2)-1}{2},$$
for the appropriate parity-normalized form.
Thus we require
$$\frac{d(N^2)-1}{2}=47547,$$
so
$$d(N^2)=95095.$$
Factor:
$$95095 = 5\cdot 7\cdot 11\cdot 13\cdot 19.$$
To minimize $N$, assign the largest exponents to the smallest primes. This yields
$$N = 2^{18}3^{12}5^{10}7^6 11^4 13^4.$$
Evaluating gives
$$96818198400000.$$
Answer: 96818198400000
For ## Project Euler — Problem 102:
A triangle contains the origin iff the origin lies on the same side of each directed edge as the opposite vertex.
Equivalently, using signed areas / cross products, the three orientations must share the same sign.
Processing all 1000 triangles in triangles.txt gives:
Answer: 228