How can you go about finding the smallest number (x) that is evenly divisible by a set of numbers from 1 to n?(adsbygoogle = window.adsbygoogle || []).push({});

For example:

If n = 3, x=6

n = 4, x=12

n=5, x=60

n=6, x=60

This is easy to do when n is a small number, however how would one go about finding the answer if n=20 for example?

I have written a program that tries to brute force the answer, but I'm almost certain there's a much more elegant way to do it. Any advice?

**Physics Forums | Science Articles, Homework Help, Discussion**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# How to find the number that's evenly divisible by a set of numbers from 1 to n?

**Physics Forums | Science Articles, Homework Help, Discussion**