Problem

Source: IMOC 2023 N2

Tags: factorial, number theory



Find all pairs of positive integers $(a, b)$ such that $a^b+b^a=a!+b^2+ab+1$.