A connection between primes, right triangles and $\pi$. This question is motivated by the question A mysterious connection between primes and $\pi$ in MO hence a similar title. Is the following claim true?

Conjecture: The ratio of the sum of the squares of the hypotenuse to the
  sum of the area of all Pythagorean triangles in which the hypotenuse
  is a prime $\le n$ tends to $2\pi$ as $n \to \infty$.

Source code: 
p = 5
sn = sd = 0
target = step = 10^3

while True:
    if p%4 == 1:
        x = 1
        while x < p:
            y = (p^2 - x^2)^0.5
            if y%1 == 0:
                sn = sn + x^2 + y^2
                sd = sd + x*y
                i = i + 1
                break
            else:
                x = x + 1
    p = next_prime(p)
    if p > target:
        target = target + step
        print p, sn/sd.n()

 A: This follows from certain results about equidistribution of Gaussian primes in sectors, references for which you can find e.g. here. I will not perform the detailed calculations, but rather outline the ideas involved.
For a prime $p\equiv 1\pmod 4$, the nontrivial solutions $(x,y)\in\mathbb N^2$ of $x^2+y^2=p^2$ arise as $x+yi=(a+bi)^2$ for a Gaussian prime $a+bi$ in the sector $\{re^{i\theta}:0<\theta<\pi/4\}$ (or the same with $x,y$ swapped, but for the sums you are interested in it won't make a difference). For every $p$ there will be precisely one such prime, let us write $a+bi=\sqrt{p}e^{i\theta_p},0<\theta_p<\pi/4$. Then $x+yi=pe^{2i\theta_p}$. We have $x^2+y^2=p^2$ and
$$xy=p^2\sin 2\theta_p\cos 2\theta_p=\frac{p^2}{2}\sin 4\theta_p.$$
Now by the result cited above, the angles $\theta_p$ are equidistributed in $[0,\pi/4]$, and so the angles $\psi_p:=4\theta_p$ are equidistributed in $[0,\pi]$. Since the average value of $\sin x$ on $[0,\pi]$ is $2/\pi$, we that the sum of $xy$ over all primes $p\leq N$ for some $N$ will be approximately
$\frac{2}{\pi}\sum_{p\leq N}\frac{p^2}{2}=\frac{1}{\pi}\sum_{p\leq N}p^2$,
so the sum of the areas of the triangles will be approximately half that, $\frac{1}{2\pi}\sum_{p\leq N}p^2$.
On the other hand, the sum of the squares of hypotenuses is clearly $\sum_{p\leq N}p^2$. Taking the quotient of the latter with the former we get the desired $2\pi$.
