Find square difference: Difference between revisions
→{{header|Ruby}}: Add Ruby
(→{{header|ALGOL 68}}: Tweak to make it more obvious that a loop is not being used to find the least square...) |
(→{{header|Ruby}}: Add Ruby) |
||
Line 701:
which returns the same result in only 9.2 seconds.
=={{header|Ruby}}==
<syntaxhighlight lang="ruby">p (1..).detect{|n| n*n - (n-1)*(n-1) > 1000 }</syntaxhighlight>
{{out}}
<pre>501
</pre>
=={{header|Sidef}}==
<syntaxhighlight lang="ruby">var N = 1000
|