Skip to content

Instantly share code, notes, and snippets.

@migimunz
Created September 14, 2014 15:55
Show Gist options
  • Save migimunz/0293b2be10c032b4d63a to your computer and use it in GitHub Desktop.
Save migimunz/0293b2be10c032b4d63a to your computer and use it in GitHub Desktop.
function f(x) {
return Math.round(1 / (0.5 * Math.sqrt(Math.PI)) * Math.pow(Math.E, (-Math.pow(x%3, 2)/Math.pow(0.1,2)))
+ 1 / (0.27 * Math.sqrt(Math.PI)) * Math.pow(Math.E, (-Math.pow(x%5, 2)/Math.pow(0.1,2))));
}
var text = ["%", "Fizz", "Buzz", "FizzBuzz"];
for(var x = 1; x <= 100; ++x) {
console.log(text[f(x)].replace('%', x));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment