Frobenius numbers: Difference between revisions
Content added Content deleted
(Added Quackery.) |
(→{{header|Ruby}}: Add Ruby) |
||
Line 1,448: | Line 1,448: | ||
Found 25 Frobenius numbers |
Found 25 Frobenius numbers |
||
done...</pre> |
done...</pre> |
||
=={{header|Ruby}}== |
|||
<syntaxhighlight lang="ruby">require 'prime' |
|||
Prime.each_cons(2) do |p1, p2| |
|||
f = p1*p2-p1-p2 |
|||
break if f > 10_000 |
|||
puts f |
|||
end |
|||
</syntaxhighlight> |
|||
{{out}} |
|||
<pre>1 |
|||
7 |
|||
23 |
|||
59 |
|||
119 |
|||
191 |
|||
287 |
|||
395 |
|||
615 |
|||
839 |
|||
1079 |
|||
1439 |
|||
1679 |
|||
1931 |
|||
2391 |
|||
3015 |
|||
3479 |
|||
3959 |
|||
4619 |
|||
5039 |
|||
5615 |
|||
6395 |
|||
7215 |
|||
8447 |
|||
9599 |
|||
</pre> |
|||
=={{header|Rust}}== |
=={{header|Rust}}== |