Guest User

Untitled

a guest
Nov 18th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.19 KB | None | 0 0
  1. #The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.
  2.  
  3. #Find the sum of all the primes below two million.
  4.  
  5. require 'mathn'
  6.  
  7. p (Prime.take_while{|p| p<2000000}).inject(0) {|sum,item| sum+item}
Add Comment
Please, Sign In to add comment