Skip to content

Instantly share code, notes, and snippets.

@trillerpfeife
Created March 2, 2016 01:07
Show Gist options
  • Save trillerpfeife/643f46c0be39df5149d6 to your computer and use it in GitHub Desktop.
Save trillerpfeife/643f46c0be39df5149d6 to your computer and use it in GitHub Desktop.
super crasy function checks whether n is dividable by 2 or subtractable by 5
function check(n) {
var history = "(" + n;
var number = n;
while (number > 3) {
if ((number % 2)=== 0) {
number = number / 2;
history += ")/2"
}
else {
number = number - 5;
history += "-3"
}
}
return history +" = "+ number;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment