Created
January 17, 2018 22:14
-
-
Save aromig/eb12dd39115a09fb1c4ccb6e48692a96 to your computer and use it in GitHub Desktop.
Largest whole number less than 2007 that's divisible by 2, 3, 4, 5, 6, and 7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// My 11 year old's 6th grade homework one day: https://pbs.twimg.com/media/DLVjmkXUEAAF2_D.jpg | |
// Problem of the Week: Find the largest whole number less than 2007 that is divisible by 2, 3, 4, 5, 6, and 7. | |
// He wrote down 1680 and wanted me to check to see if he was right. | |
// Checked it the easiest way I knew. | |
for (var i = 2007; i > 0; i--) | |
if (i % 7 == 0) | |
if (i % 6 == 0) | |
if (i % 5 == 0) | |
if (i % 4 == 0) | |
if (i % 3 == 0) | |
if (i % 2 == 0) | |
break; | |
console.log(i); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment