http://stackoverflow.com/questions/295579/fastest-way-to-determine-if-an-integers-square-root-is-an-integer
Ok, maybe it's not such a simple problem!
EDIT: Wait maybe I'm overcomplicating this.
Let's take 40 and 36.
The factors of 40 are 1,2,4,5,8,10.
The factors of 36 are 1,2,3,4,6,12.
Is there any way I can get the factors of a number and then square each one to see if they make the product?
So for 40:
1x1 != 40
2x2 != 40
4x4 != 40
5x5 != 40
8x8 != 40
10x10 != 40
For 36:
1x1 != 36
2x2 != 36
3x3 != 36
4x4 != 36
6x6 = 36
12x12 != 36
Hmmmmm. I can't think of any situations where it wouldn't work.
The nagging suspicion that I'm misinterpreting this problem is creeping up on me.
No comments:
Post a Comment