Skip to content

Instantly share code, notes, and snippets.

@ichyo
Created June 13, 2010 16:52
Show Gist options
  • Save ichyo/436805 to your computer and use it in GitHub Desktop.
Save ichyo/436805 to your computer and use it in GitHub Desktop.
=begin
prime = Array.new
count = 1
prime[0] = 2
prime[1] = 3
no = 5
sum = 5
while no<2000000
for i in (1..count)
break if (no % prime[i] == 0)
end
if (i == count)
count += 1
prime[count] = no
sum += no
end
no += 2
end
print sum
=end
sum = 5
no = 5
while no <2000000
i = 3
until i*i>no
break if (no%i==0)
i+=2
end
sum += no if (i*i>no)
no += 2
end
print sum
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment