DEV Community

loading...

Discussion on: Project Euler #5 - Finding the Smallest Multiple

dwayne profile image
Dwayne Crooks

Is it because you multiplied them all together that dividing by one of the numbers puts you in the same place you started before multiplying?

Yes.

I have no idea how this "follows".

3*5*6*7*8*9*10 = 3*5*6*7*(2*4)*9*10 => 2, 4 and 8 are factors.

If 10 = 2*5 then 2 and 5 are factors. So that's what I'm doing above.

Why didn't you remove 9 instead of 3?

If I removed 9 then 9 would no longer be a factor of what remains. There's no way to make a 9 with what remains.

And why does "6 divide 5*7*8*9"

Because we can take a 2 from 8 and a 3 from 9 to show that 6 is a factor, i.e. 5*7*8*9 = 5*7*4*(2*3)*3 = 5*7*4*6*3.

but "7 does not divide 5*8*9"

5*8*9 = 5*2*2*2*3*3, see no 7's :).

Thread Thread
therealkhitty profile image
Mary Thompson

I see. This makes more sense. Thank you.

Thread Thread
dwayne profile image
Dwayne Crooks

You're welcome.