Skip to content

Instantly share code, notes, and snippets.

@clupasq
Last active October 5, 2015 07:58
Show Gist options
  • Save clupasq/2775292 to your computer and use it in GitHub Desktop.
Save clupasq/2775292 to your computer and use it in GitHub Desktop.
Golfscript snippets
.,{)\.@%!},,2= # is number prime (expects number on stack and adds 1 or 0 (leaves number on stack))
:§,{)§\%!},,2= # just like above, except this consumes the number from the stack.
..,1>{*}*\%)= # shorter version, using Wilson's theorem (https://en.wikipedia.org/wiki/Wilson%27s_theorem)
# must take a parameter > 1, therwise fails
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment