Problem

Source: Macedonia National Olympiad 2017

Tags: number theory, algebra



Find all natural integers $n$ such that $(n^3 + 39n - 2)n! + 17\cdot 21^n + 5$ is a square.