Problem

Source: Bulgarian Spring Tournament 2023 10.4

Tags: number theory



Find all positive integers $n$, such that there exists a positive integer $m$ and primes $1<p<q$ such that $q-p \mid m$ and $p, q \mid n^m+1$.