# Why is the fractional part of the X and Y intercepts of a line equal when the line intersects the sqrt() of a semiprime AND its prime factors?

I found an interesting property when trying to use some simple geometry to solve a math problem. If anyone can explain why this happens I'd greatly appreciate it!

Given $c$ is a semiprime number (made from the product of primes $p_1$ and $p_2$) and $s=\sqrt{c}$, if I have a line that intersects the point ($s$,$s$) and also the point ($p_1$,$p_2$) the fractional parts of the intercepts of the $Y$ and $X$ axes are equal (and also equal to the fractional part of $s$). Why does this happen?

Note also that if $c$ is not a semiprime but any old composite number, the fractional parts of the intercepts are equal every time the line intersects factors of $c$ when pivoting about ($s$,$s$).

See the image below. It shows an example of the above when $c=77$ ($p_1=11$ and $p_2=7$).

Now that's an interesting observation.

My $n$ is your $c$, and my $(q,p)$ are your $(p_1,p_2)$.

Well, let's see. The equation of the line would obviously be $y=s+(p-s){x-s\over q-s}$.

Plug $x=0$, and you'll find the Y-intercept at $$y=s-(p-s){s\over q-s}=s+(s-p){s(q+s)\over q^2-s^2}=s+(s-p){qs+pq\over q^2-pq}=s+{s^2-p^2\over q-p}=\color{red}{s+p}$$

Plug $y=0$, and you'll find the X-intercept at $$x={-s\over p-s}(q-s)+s=s+{s(q-s)(p+s)\over s^2-p^2}=s+{s(pq-ps+qs-s^2)\over s^2-p^2}=\\=s+{s(pq-ps+qs-s^2)\over s^2-p^2}=s+{s^2(q-p)\over pq-p^2}=\color{red}{s+q}$$

So it is not surprising, after all, that both intercepts have the same fractional part as $\sqrt n$.

Also, note that $p$ and $q$ absolutely don't have to be prime. What's important is that both are integers and their product is $n$.