2016年1月4日 星期一

Pythagorean triples

1. wiki:


2. Euclid's formula is a fundamental formula for generating Pythagorean triples given an arbitrary pair of positive integers m and n with m > n.
  • a = m^2 - n^2
  • b = 2mn
  • c = m^2 + n^2
where m and n is coprime and odd parity.

How to iterate all coprime pairs:

沒有留言:

張貼留言