I currently am working on a minor programming project, and I have a program that can plot points in the problem above. However, this requires a lot of computing power that the average school chromebook simply cannot output. I realized that the points were very specifically placed and followed a pattern, but I have no idea where to start linking the info together. [Solutions from the range (-30,-30) to (30,30)][1] If anyone is interested in the code:
var a;
var b;
var c;
var list=[];
// Find A and B
for(var i = -30; i<=30; i++){
a=i;
console.log(a);
for(var j = -30; j<=30; j++){
b=j;
console.log(b);
wholenum(a, b);
}
}
// Test If a^2+b^2 makes a whole number
function wholenum(a, b) {
if(Math.floor(Math.sqrt(a^2+b^2)) === Math.sqrt(a^2+b^2)){
c=Math.sqrt(a^2+b^2);
appendItem(list, "("+a+","+b+")");
// testpyth(a, b, c);
}
}
I beleive it could be solutions to a system of a number of equations, but im not sure.
Thank you in advance for any help.
[1]: https://i.stack.imgur.com/0GIKG.png
There are many formulas to generate Pythagorean triples and the most common one is Euclid's, which works but requires some restrictions on input to avoid generating trivial and imprimitive triples. $$A=m^2-k^2\qquad B=2mk\qquad C=m^2+k^2$$
There is another formula that generates a Pythagorean triple for any pair of natural numbers $\space (n,k)\space$ with fewer imprimitives than any other formula I have seen.
\begin{align*} &A=(2n-1)^2+&&2(2n-1)k\\ &B= &&2(2n-1)k+2k^2\\ &C=(2n-1)^2+&&2(2n-1)k+2k^2 \end{align*}
Using either formula, we will have $$X=A\quad\text{and}\quad Y=B$$
and we can use these to generate a scatter plot similar to the one shown here.