by RonPurewal Tue Oct 30, 2007 4:05 am
Wow, really? They asked you that?
A more systematic approach: First, rule out negative numbers and 0.
* 2^(negative integer) is between 0 and 1, whereas (negative integer)^2 is greater than 1. So, no negatives work.
* 2^0 = 1, 0^2 = 0, so 0 doesn't work either.
Positive numbers:
* Try 1, 2, 3, 4, 5, and notice that 2 and 4 happen to work.
- Notice that 2^5 is bigger than 5^2
- Notice that 2^(next consecutive integer) is always double the number you just found, whereas the next perfect square is never even close to double the last one
- So, 2^k will grow at a rate that outpaces that of k^2, and never again the twain shall meet
I gather that this is pretty much what you did, but with a little more formality thrown in.