Skip to content

Instantly share code, notes, and snippets.

@nerdybeast
Last active November 6, 2016 19:49
Show Gist options
  • Save nerdybeast/574621dde18a6a75efb8324e9604cdc0 to your computer and use it in GitHub Desktop.
Save nerdybeast/574621dde18a6a75efb8324e9604cdc0 to your computer and use it in GitHub Desktop.
Euler 5 - Smallest Multiple
'use strict';
const MIN = 1;
const MAX = 25;
let stillSearching = true;
let answer = MAX;
do {
let foundAnswer = true;
for(var i = MIN; i <= MAX; i++) {
if(answer % i !== 0) {
foundAnswer = false;
break;
}
}
stillSearching = !foundAnswer;
if(stillSearching) answer += MAX;
} while (stillSearching);
console.log(answer);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment