(Second time I ask this because the previous was not very clear so I deleted it) Hi, I've trying to solve this problem (competitive programming) called Divide a days ago, it's states:
Given $p,q,n \le 10^{10}$, find all the tuples such that:
$\frac {ab} {a+b} = c $
($a+b|ab$, $a \in [1;p]$, $b\in [1;q]$, $c\in [1;n]$, all integers)
Note: this is not about to check whether $ab$ is divisible by $a+b$ but to find how many valid tuples (a,b) when put into that expression above, results results in a number $c\le n$
As the values $p,q,n$ are too big and cannot be calculated by brute-force, is there a way to calculate how much of such tuples exists in $O(1)$?
Original problem: https://dmoj.uclv.edu.cu/problem/2023orcop1112b
What I've reached by myself:
When $a=b$ then $\frac a 2 \le n$ and $a \le 2n$ , so that gives some tuples of the form $(2k, 2k)$
When $a=kb$ then $\frac {kb} {k+1}$ as $k$ and $k+1$ are coprime, must find a $k+1$ that divides $b$, (can be easily calculated)
Nothing more useful :/