Last active
October 5, 2015 07:58
-
-
Save clupasq/2775292 to your computer and use it in GitHub Desktop.
Golfscript snippets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.,{)\.@%!},,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