Trial and error aren't necessary.
Increasing 12% per month means that at any time,
there are (1.12) x (the number there were a month earlier).
After, say, 'M' months, the number has grown by (1.12)^M power.
We want to know what 'M' has to be so that 50(1.12)^M = 1,000
Divide each side by 50 : (1.12)^M = 20
Take the log of each side: M log(1.12) = log(20)
Divide each side by log(1.12): M = log(20) / log(1.12)
M = 1.301 / 0.0492 = 26.44 months