Given some $b \in \mathbb Z^+$, efficiently find all values for $a \in \mathbb Z^+$ such that...
- $1 \le a \le b$.
- $a^2 + b^2$ is a perfect square.
Efficiently means with a method faster than testing all the values in $[1, b]$.
Given some $b \in \mathbb Z^+$, efficiently find all values for $a \in \mathbb Z^+$ such that...
Efficiently means with a method faster than testing all the values in $[1, b]$.
It is necessary to expand the number in $b^2$ into two different factors $b^2=p_1\cdot p_2$ where $p_1<p_2$ and both of them even or both of them odd. Then solve the system of equations:$$c-a=p_1; c+a=p_2$$ $$c=\frac{p_1+p_2}{2}; a=\frac{p_2-p_1}{2}$$
There is definitely a faster way of finding specific triples than testing all values of $x^2+B^2$.
To find Pythagorean triples with a given side B, we begin with the function: $$n=\frac{B}{2m}\text{ where }\biggl\lceil\sqrt{\frac{B}{2}}\space\space\biggr\rceil\le m\le\frac{B}{2}\text{ and selecting integer values of }n.$$
Sometimes $A>B$. For example triples with side $B=20$. $$\biggl\lceil\sqrt{\frac{B}{2}}\space\space\biggr\rceil=5\le m \le \frac{B}{2}=10$$ In the search we find $f(5,2)=(21,20,29)\text{ and }f(10,1)=(99,20,101).$
Somtimes $A$ can be greater than $and$ less than the same length $B$.
If we want to match sides with $(11,60,61)$, we let $m=6\text{ to} 30$ and select the integer values of $n$. $$\text{For }(m,n)\qquad A=m^2-n^2\qquad B=2mn\qquad C=m^2+n^2$$
$$f(6,5)=(11,60,61)\quad f(10,3)=(91,60,109)\quad f(15,2)=(221,60,229)\quad f(30,1)=(899,60,901)$$