Problem

Source: Pan-American Girls' Mathematical Olympiad 2022, P6

Tags: number theory, PAGMO, prime numbers



Ana and Bety play a game alternating turns. Initially, Ana chooses an odd possitive integer and composite $n$ such that $2^j<n<2^{j+1}$ with $2<j$. In her first turn Bety chooses an odd composite integer $n_1$ such that \[n_1\leq \frac{1^n+2^n+\dots+(n-1)^n}{2(n-1)^{n-1}}.\]Then, on her other turn, Ana chooses a prime number $p_1$ that divides $n_1$. If the prime that Ana chooses is $3$, $5$ or $7$, the Ana wins; otherwise Bety chooses an odd composite positive integer $n_2$ such that \[n_2\leq \frac{1^{p_1}+2^{p_1}+\dots+(p_1-1)^{p_1}}{2(p_1-1)^{p_1-1}}.\]After that, on her turn, Ana chooses a prime $p_2$ that divides $n_2,$, if $p_2$ is $3$, $5$, or $7$, Ana wins, otherwise the process repeats. Also, Ana wins if at any time Bety cannot choose an odd composite positive integer in the corresponding range. Bety wins if she manages to play at least $j-1$ turns. Find which of the two players has a winning strategy.