Skip to content

Instantly share code, notes, and snippets.

@marcuszierke
Last active March 24, 2020 16:27
Show Gist options
  • Save marcuszierke/021daf6ad224f8da4bfb29e95bfba133 to your computer and use it in GitHub Desktop.
Save marcuszierke/021daf6ad224f8da4bfb29e95bfba133 to your computer and use it in GitHub Desktop.
MagicNumber
const magicNumber = (range) => {
[...Array(range + 1).keys()].map(n => {
const res = n**5 - 5*n**3 + 4*n;
if (res >= 120 && (res % 120 !== 0)) {
return n;
}
})
return 'no number found';
}
console.log(magicNumber(1000));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment