Babbage problem: Difference between revisions

Content added Content deleted
imported>KayproKid
(Added S-BASIC example)
m (→‎{{header|Wren}}: Minor tidy)
Line 4,964: Line 4,964:
=={{header|Wren}}==
=={{header|Wren}}==
{{libheader|Wren-fmt}}
{{libheader|Wren-fmt}}
<syntaxhighlight lang="ecmascript">/*
<syntaxhighlight lang="wren">/*
The answer must be an even number and it can't be less than the square root of 269,696.
The answer must be an even number and it can't be less than the square root of 269,696.
So, if we start from that, keep on adding 2 and squaring it we'll eventually find the answer.
So, if we start from that, keep on adding 2 and squaring it we'll eventually find the answer.
Line 4,970: Line 4,970:
*/
*/


import "/fmt" for Fmt // this enables us to format numbers with thousand separators
import "./fmt" for Fmt // this enables us to format numbers with thousand separators
var start = 269696.sqrt.ceil // get the next integer higher than (or equal to) the square root
var start = 269696.sqrt.ceil // get the next integer higher than (or equal to) the square root
start = (start/2).ceil * 2 // if it's odd, use the next even integer
start = (start/2).ceil * 2 // if it's odd, use the next even integer