You need to notice that the problem provides the information that `n^2 = 3mp` , hence, `p = n^2/(3m)` , thus, substituting `n^2/(3m)` for `p` in equation, yields:

`mx^3 + nx^2 + n^2/(3m)x + q = 0`

Multiplying by `27m^2` yields:

`27m^3x^3 + 27m^2nx^2 + 9mn^2x + 27m^2q = 0`

Adding and subtracting `n^3` yields:

`27m^3x^3 + 27m^2nx^2 + 9mn^2x + + 27m^2q + n^3 - n^3 = 0`

You should notice that you may obtain `27m^3x^3 + 27m^2nx^2 + 9mn^2x + n^3` expanding the cube `(3mx + n)^3` such that:

`(3mx + n)^3 + 27m^2q - n^3 = 0`

You should come up with the substitution such that:

`27m^2q - n^3 = k^3 => (3mx + n)^3 + k^3 = 0`

Using the formula `a^3 + b^3 = (a+b)(a^2-ab+b^2)` yields:

`(3mx + n) = -k => x = -(k+n)/(3m)`

`(3mx + n)^2 - k(3mx + n) + k^2 = 0 => (3mx + n) = -k((-1+-i*sqrt 3)/2)`

If `m=n=0` yields `px+q = 0 => x = -q/p`

**Hence, evaluating the solutions to the equation `mx^3+nx^2+px+q=0` , using the condition provided by the problem, yields x**` = -(k+n)/(3m); x = -(k((-1+-i*sqrt 3)/2) + n)/(3m), x = -q/p.`