Question 831254
Put in symbols, we are saying:

(x^2) - (522 + 3x) = 126

This is the same as saying:
(x^2) -3x - 648 = 0

Factorizing:
(x - 27)(x + 24) = 0

The solutions are:  x = 27; x = -24;

For our purposes, the only important solution is x = 27, since the number must be 27.

Check: 27^2 = 729;  522 + 3 times 27 = 522 + 81 = 603;  729 - 603 = 126