So I need to multiple all the prime numbers in that range
Not exactly. You need to multiply by the highest powers of the primes in the range.
You do agree that the problem is implicitly asking you to find the LCM of 1,2,3,...,20?
Yes. And as you mentioned there are at least two ways to solve the problem. Both are valid.
And I don't disagree with you. Start with brute force and improve. You'd then have something to test your optimizations, clever code etc against.
We're on the same page 😉
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Not exactly. You need to multiply by the highest powers of the primes in the range.
Yes.
And as you mentioned there are at least two ways to solve the problem. Both are valid.
We're on the same page 😉