### How to find instances where $d(a,b) = p^2$ for $p$ a prime

Suppose I have a dimension formula (for a Lie algebra representation) given by
$\mathrm{dim}_{a,b} = {(a+1)(b+1)(a+b+2) \over 2}$. I now would like to find pairs $(a,b)$ where $\dim_{a,b} = p^2$ for $p$ a prime? What are some techniques for accomplishing this? Should I first filter out a list of primes using `isprime`

and then check possible pairs $(a,b)$ for each prime $p < N$, say $1000$.