2024 Kosovo Team Selection Test

P1

Find all prime numbers $p$ and $q$ such that $p^q + 5q - 2$ is also a prime number.

P2

Let $\omega$ be a circle and let $A$ be a point lying outside of $\omega$. The tangents from $A$ to $\omega$ touch $\omega$ at points $B$ and $C$. Let $M$ be the midpoint of $BC$ and let $D$ a point on the side $BC$ different from $M$. The circle with diameter $AD$ intersects $\omega$ at points $X$ and $Y$ and the circumcircle of $\bigtriangleup ABC$ again at $E$. Prove that $AD$, $EM$, and $XY$ are concurrent.

P3

Find all functions $f:\mathbb R\to\mathbb R$ such that $$(x-y)f(x+y) - (x+y)f(x-y) = 2y(f(x)-f(y) - 1)$$for all $x, y\in\mathbb R$.

P4

For an integer $n>2$, the tuple $(1, 2, \ldots, n)$ is written on a blackboard. On each turn, one can choose two numbers from the tuple such that their sum is a perfect square and swap them to obtain a new tuple. Find all integers $n > 2$ for which all permutations of $\{1, 2,\ldots, n\}$ can appear on the blackboard in this way.