Skip to content

Instantly share code, notes, and snippets.

@aromig
Created January 17, 2018 22:14
Show Gist options
  • Save aromig/eb12dd39115a09fb1c4ccb6e48692a96 to your computer and use it in GitHub Desktop.
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
// 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