Find square difference: Difference between revisions
Content added Content deleted
m (→{{header|Wren}}: Changed to Wren S/H) |
|||
Line 1,058: | Line 1,058: | ||
=={{header|Wren}}== |
=={{header|Wren}}== |
||
The solution '''n''' for some non-negative integer '''k''' needs to be such that: ''n² - (n² - 2n + 1) > k'' which reduces to: ''n > (k + 1)/2''. |
The solution '''n''' for some non-negative integer '''k''' needs to be such that: ''n² - (n² - 2n + 1) > k'' which reduces to: ''n > (k + 1)/2''. |
||
<syntaxhighlight lang=" |
<syntaxhighlight lang="wren">var squareDiff = Fn.new { |k| ((k + 1) * 0.5).ceil } |
||
System.print(squareDiff.call(1000))</syntaxhighlight> |
System.print(squareDiff.call(1000))</syntaxhighlight> |
||