2023 AIME II Problem 15

Find the largest prime number p<1000 for which there exists a complex number z satisfying

  1. the real and imaginary part of z are both integers;
  2. |z|=\sqrt{p}, and
  3. there exists a triangle whose three side lengths are p, the real part of z^{3}, and the imaginary part of z^{3}.