Advertisement
kburnik

Logo - Je li broj prost?

Feb 19th, 2013
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. to jeliprost :n
  2. if :n = 1 [op "false]
  3. make "p int :n/2
  4. for [k 2 :p 1] [
  5. if (remainder :n :k) = 0 [op "false]
  6. ]
  7. op "true
  8. end
  9.  
  10. to testiraj :max
  11. for [i 1 :max 1] [if jeliprost :i [pr :i] ]
  12. end
  13.  
  14.  
  15. ; pozvati primjer:
  16. ; testiraj 50
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement