algorithm - How to check if a for a given number N, N^2 can be expressed as the sum of squares of two non-zero integers? -


given number n, how can find out if n^2 can expressed sum of squares of 2 non-zero integers. example if n=10, 10^2 can expressed (6^2)+(8^2). i've read such numbers n can expressed 4k+1 9 fits expression, 81 cant expressed sum of squares of 2 integers. what's right way this?

the numbers want hypotenuses ("c" values) of pythagorean triples, series a009000 in oeis. comments there point out number hypotenuse if , if it's divisible @ least 1 prime of form 4k+1. can check whether number hypotenuse obtaining prime factorization , seeing whether of primes have remainder of 1 when divided 4.

in case of example, 81 doesn't qualify because prime factor 3. 81 divisible 9, 9 isn't prime.


Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -