For a non-negative integer $k$, the triple $(p,q,r)$ of positive integers is called a $k$-shifted Pythagorean triple if $$p^2 + q^2 + k = r^2$$
$(p, q, r)$ is said to be primitive if $\gcd(p, q, r)=1$.
Let $P_k(n)$ be the number of primitive $k$-shifted Pythagorean triples such that $1 \le p \le q \le r$ and $p + q + r \le n$. For example, $P_0(10^4) = 703$ and $P_{20}(10^4) = 1979$.
Define
$$\displaystyle S(m,n)=\sum_{k=0}^{m}P_k(n).$$
You are given that $S(10,10^4) = 10956$.
Find $S(10^2,10^8)$.
This problem requires deep understanding and knowledge of number theory, specifically involving concepts of primitive Pythagorean triples and quadratics. Coming up with a simple stepwise solution isn’t entirely possible due to the nature of the problem as it is a software question that requires a search algorithms, a brute force way of solving which has to run through all possible solutions to find the correct one.
First we notice that for a 1-shifted Pythagorean triple, (i.e., $k = 1$) we can simply subtract 1 from $p$, $q$, and $r$ to get a primitive Pythagorean triple (unless $p,q,$ or $r$ is 1.) The reduced Pythagorean triple will sum to $n – 3$. Using the formula from number theory for the number of primitive Pythagorean triples below a given limit, We get $P_1(n) = 2P_0(n-3)$.
The second observation is for $k > 1$, we can add $k – 1$ to one of $p$, $q$, and $r$ to get a 1-shifted Pythagorean triple. And if a reduced form of the triple exists where none of $p$, $q$, or $r$ equals 1, then they are counted $P_k(n)$ times. There are 3 choices for which of $p$, $q$, or $r$ to increment, so $P_k(n) = 3 * P_1(n-k+1)$ for $2 \leq k \leq n$.
Finally, we can combine these result to solve the given equation:
$$\displaystyle s(m,n)=s(m,n-1)+P_0(n-3)+3\sum_{k=m-n+4}^{m-1}P_1(n-k+1).$$
where $s(m,n)$ is the number of primitive Pythagorean triple up to a limit $\leq n$ and gcd $(a,b,c)=1$. The value of $s(10^2,10^8)$ should be found using algorithms or software as it is a very large and complex computation which requires high computational power.
Again, the above reasoning cannot be followed by direct steps but provide a set of important considerations on the way to tackle the problem.
More Answers:
Triangle of Circular ArcsCircle of Coins
Range of Periodic Sequence