Problem

Source: Latvian TST for Baltic Way 2022 P16

Tags: number theory



Find all triples of positive integers $(a,b,p)$, where $p$ is a prime, such that both $a+b$ and $ab+1$ are some powers of $p$ (not necessarily the same).