Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- alias prime {
- var %x $1
- var %y 1
- var %factors 0
- while (%y <= %x) {
- var %fct %x % %y
- if (%fct == 0) { inc %factors }
- inc %y
- }
- if (%factors == 2) {
- msg $active %x is a prime.
- }
- else {
- msg $active %x is not a prime.
- }
- }
Add Comment
Please, Sign In to add comment