Advertisement
Guest User

Untitled

a guest
Jan 5th, 2015
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. #!/usr/bin/ruby
  2.  
  3. nop = 0
  4. i = 1
  5.  
  6. while nop < 1000 do
  7. i += 1
  8. prime = true
  9.  
  10. if i % 2 == 0
  11. prime = false
  12. else
  13. k = (i - 1)/2
  14. while k != 1 do
  15. puts k
  16. if i % k == 0
  17. prime = false
  18. break
  19. k = k -1
  20. end
  21. end
  22. if prime
  23. puts i
  24. nop += 1
  25. end
  26. end
  27. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement