fork download
  1. max = 100
  2. arr = Array.new(max)
  3. n = 2
  4.  
  5. while n <= max
  6. i = n+n
  7. while i <= max
  8. arr[i] = true
  9. i += n
  10. end
  11. n+=1
  12. while arr[n] == true && n <= max
  13. n += 1
  14. end
  15. if n == max+1
  16. break
  17. end
  18. end
  19.  
  20. for i in 2..max
  21. if arr[i] != true
  22. puts i
  23. end
  24. end
  25.  
Success #stdin #stdout 0s 4760KB
stdin
Standard input is empty
stdout
2
3
5
7
11
13
17
19
23
29
31
37
41
43
47
53
59
61
67
71
73
79
83
89
97