Babbage problem: Difference between revisions

→‎{{header|Perl 6}}: Add Perl 6 example
mNo edit summary
(→‎{{header|Perl 6}}: Add Perl 6 example)
Line 106:
}</lang>
<pre>25264</pre>
 
=={{header|Perl 6}}==
{{works with|Rakudo|2016.03}}
This could certainly be written more concisely. Extra verbiage is included to make the process more clear.
<lang perl6># For all positives integers from 1 to Infinity
for 1 .. Inf -> $integer {
# calculate the square of the integer
my $square = $integer²;
# print the integer and square and exit if the square modulo 1000000 is equal to 269696
print "{$integer}² equals $square" and exit if $square % 1000000 == 269696;
}</lang>
{{out}}
<pre>25264² equals 638269696</pre>
 
=={{header|Processing}}==
10,339

edits