3B. Determine all natural numbers $x$ such that $x^{3}-x+p=507$, where $p$ is a prime number.
Solution. The given equation is written in the form

$$
x(x-1)(x+1)+p=507
$$

The term $x(x-1)(x+1)$ is the product of three consecutive natural numbers, so it is divisible by 3. Similarly, 507 is also divisible by 3, so it follows that $p$ must also be divisible by 3. The only prime number divisible by 3 is $p=3$. Now the equation reads $x(x-1)(x+1)=504$, or $x(x-1)(x+1)=7 \cdot 8 \cdot 9$, so $x=8$.

4AB. To get from his home to the nearest store, Kristijan moves along a marked path: he walks 200 meters east, then 150 meters northeast, and finally 100 meters east (the northeast direction is defined by the bisector of the angle formed by the north and east directions). Kristijan wanted to shorten his path and began to move through the park in a straight line, directly from his home to the store. When he met the marked path, he encountered an old man, was embarrassed by his stern look, and decided to continue along the marked path to the store. By how much did Kristijan shorten his path from home to the store?