Set of natural number solutions to $x^2+y^2=z^2$ I know that there are infinitely many solutions to the equation $x^2+y^2=z^2$
 $x,y,z\in N  $
      but if we restrict the numbers to {1,2,3,4...n}, then how many triplets (x,y,z) exist?
Asymptotical estimates are fine if an exact answer isn't possible.
 A: The number of solutions of $x^2+y^2=z^2$ in coprime integers with $0\lt x\lt y\lt z\le n$ is tabulated at the OEIS. If you call it $a(n)$, then Lehmer proved $$\lim_{n\to\infty}{a(n)\over n}={1\over2\pi}$$ 
The same, without the restriction to coprime solutions, does not appear to be tabulated at OEIS. Standard techniques from Analytic Number Theory should be able to get asymptotic results from the one for coprime solutions, but I don't have the time to try to work through this. 
No, I'm not fighting a duel in the morning, but thanks for asking. 
A: We need to restrict $z \le n$ as $x,y$ will be smaller still.  Mathworld states (specialized to this case) that we can factor $z^2$ as $2^{a_0}p_1^{2a_1}\ldots p_n^{2a_n}q_1^{b_1}\ldots q_m^{b^m}$ where the primes $p_i$ are $\equiv 3 \pmod 4$ and the primes $q_i$ are $\equiv 1 \pmod 4$.  All the exponents are even because $z^2$ is a square.  Then the number of ways of writing $z^2$ as a sum of squares, ignoring order and including $z^2+0^2$ is $\frac 12((b_1+1)\ldots (b_m+1) -(-1)^{a_0})$  Now add up over the $z$'s
