Well, I don't know if someone has found it before, but it took me a whole half an hour to figure out.
Yes, that constraint was common logic for me, so I hadn't thought of including it.
Thanks
PS:
Here's the proof:
I figured you found certain pythag triples by finding that the difference between two adjacent numbers, eg 12 and 13, if the difference's root is an integer:
(c^2 - (c - 1)^2) = a^2
where c - 1 = b
I could then simplify the above
c^2 - c^2 + 2c - 1 = a^2
a^2 = 2c - 1
a = √(2c - 1)
I then tried using the difference for two numbers of difference 2, where the difference of their squares is an integer:
(c^2 - (c - 1)^2) + ((c - 1)^2 - (c - 2)^2) = a ^ 2
where c - 2 = b
Simplify:
c^2 - c^2 + 2c - 1 + c^2 - 2c + 1 - c^2 + 4c - 4 = a^2
a^2 = 4c - 4
a = √(4c - 4)
To save the typing, the result for the two numbers with difference three is:
a = √(6c - 9)
where c - 3 = b
Wait, there's a pattern...
a = √(2(c - 0.5))
a = √(4(c - 1))
a = √(6(c - 1.5))
a = √(2x(c - x/2))
a = √(2xc - x^2)
Euclid beat you to it.
Pythagorean triple - Wikipedia, the free encyclopedia
(And actually, I think that the Babylonians may have known about the formula as well. You may need to check up on that, though.)