Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/ruby
- nop = 0
- i = 1
- while nop < 1000 do
- i += 1
- prime = true
- if i % 2 == 0
- prime = false
- else
- k = (i - 1)/2
- while k != 1 do
- puts k
- if i % k == 0
- prime = false
- break
- k = k -1
- end
- end
- if prime
- puts i
- nop += 1
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement