If $x$ is a positive integer such that $1^{x+2} + 2^{x+1} + 3^{x-1} + 4^x = 1170$, what is the value of $x$?
a=1; c=1^(a+2) + 2^(a+1) + 3^(a-1) + 4^a; if(c==1170, goto3, goto4);printc, a; a++;if(a<1000, goto1, 0)
x = 5
Note: Somebody will give you an algebraic solution.
$4^x < 1^{x+2}+2^{x+1}+3^{x-1}+4^x = 1170$
Now $4^6=2^{12}=4096>1170$
So $x=1,2,3,4$ or $5$.
$x=1$ doesn't work.
Take mod 3 both sides and you get
$ 1+(-1)^{x+1}+0+1 \equiv 3 (mod 3)$
So $x$ must be odd.
Therefore $x=3$ or $x=5$. Then you can calculate both cases to get $x=5$