# Product of a prime and other number expressed in two ways are equal

Let $p \in \mathbb P$ be an odd prime and let $1\leq a \leq p-1$ be such a number that $$a p = \left\lceil \sqrt{a p}\right\rceil ^2-\left\lceil \sqrt{\left\lceil \sqrt{a p}\right\rceil ^2-a p}\right\rceil ^2,$$ which can be written as $$a p = \left(\left\lceil \sqrt{a p}\right\rceil -\left\lceil \sqrt{\left\lceil \sqrt{a p}\right\rceil ^2-a p}\right\rceil \right) \left(\left\lceil \sqrt{a p}\right\rceil +\left\lceil \sqrt{\left\lceil \sqrt{a p}\right\rceil ^2-a p}\right\rceil \right). \ \ \ (1)$$

I wish to prove that if the above is true then $$\left\{ \begin{array}{l l} a=\left\lceil \sqrt{a p}\right\rceil -\left\lceil \sqrt{\left\lceil \sqrt{a p}\right\rceil ^2-a p}\right\rceil \\ p=\left\lceil \sqrt{a p}\right\rceil +\left\lceil \sqrt{\left\lceil \sqrt{a p}\right\rceil ^2-a p}\right\rceil \\ \end{array} \right. \ \ \ (2)$$

In other words, the larger number in the product is equal to $p$ and smaller is equal to $a$.

If we assume this to be true, then $$\left(\left\lceil \sqrt{a p}\right\rceil +\left\lceil \sqrt{\left\lceil \sqrt{a p}\right\rceil ^2-a p}\right\rceil \right)-p = 0.$$ Note that if (1) is true, $\left\lceil \sqrt{a p}\right\rceil ^2-a p$ is a square and we can remove the ceiling function around the square root there. Then, by simplifying, we get $$\left\lceil \sqrt{a p}\right\rceil =\frac{a+p}{2},$$ which should be true if $a$ is odd.

How can I prove (2)? If (1) is true, is $a$ always odd?

Prove that the first factor in your product is less than $\lceil\sqrt{ap}\rceil$, so it's less than $p$, so it's relatively prime to $p$, so $p$ is a factor of the second factor in your product.
Then prove that the second factor in your product is less than $2\lceil\sqrt{ap}\rceil$, so it's less than $2p$, so it's $p$.