Anonymous user
Babbage problem: Difference between revisions
→{{header|Perl 6}}: add list comprehension solution
(→{{header|Perl 6}}: add whitespace) |
(→{{header|Perl 6}}: add list comprehension solution) |
||
Line 299:
=={{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.
Line 310 ⟶ 311:
print "{$integer}² equals $square" and exit if $square % 1000000 == 269696;
}</lang>
{{out}}
<pre>25264² equals 638269696</pre>
Alternatively, the following just may be declarative enough to allow Babbage to understand what's going on:
<lang perl6>say $_ if ($_² % 1000000 == 269696) for 1..99736;</lang>
{{out}}
<pre>
25264
99736
</pre>
=={{header|Processing}}==
|