Twin primes: Difference between revisions

m
Line 1,329:
=={{header|Ruby}}==
<lang ruby>require 'prime'
 
(1..8).each do |n|
count = Prime.each(10**n).each_cons(2).count{|p1, p2| p2-p1 == 2}
Line 1,344 ⟶ 1,345:
Twin primes below 10**8: 440312
</pre>
 
=={{header|Rust}}==
Limits can be specified on the command line, otherwise the twin prime counts for powers
1,149

edits