Skip to content

Instantly share code, notes, and snippets.

@gnp
Created May 14, 2011 05:55
Show Gist options
  • Save gnp/971961 to your computer and use it in GitHub Desktop.
Save gnp/971961 to your computer and use it in GitHub Desktop.
2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.
What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?
----------
2 = 2
3 = 3
4 = 2 * 2
5 = 5
6 = 2 * 3
7 = 7
8 = 2 * 2 * 2
9 = 3 * 3
10 = 2 * 5
11 = 11
12 = 2 * 2 * 3
13 = 13
14 = 2 * 7
15 = 3 * 5
16 = 2 * 2 * 2 * 2
17 = 17
18 = 2 * 3 * 3
19 = 19
20 = 2 * 2 * 5
2 * 2 * 2 * 2 * 3 * 3 * 5 * 7 * 11 * 13 * 17 * 19
$ perl -e 'print 2 * 2 * 2 * 2 * 3 * 3 * 5 * 7 * 11 * 13 * 17 * 19, "\n"'
232792560
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment