Euler's sum of powers conjecture: Difference between revisions
Content added Content deleted
(changing formatting in the intro) |
SqrtNegInf (talk | contribs) (→{{header|Raku}}: superscript in code, sigil-less, no temp. var, remove superfluous brackets, consolidate short-circuit tests) |
||
Line 3,521: | Line 3,521: | ||
=={{header|Raku}}== |
=={{header|Raku}}== |
||
(formerly Perl 6) |
(formerly Perl 6) |
||
{{Works with|rakudo|2018.10}} |
|||
{{trans|Python}}<syntaxhighlight lang="raku" line>constant MAX = 250; |
{{trans|Python}}<syntaxhighlight lang="raku" line>constant MAX = 250; |
||
my %po5{Int}; |
my %po5{Int}; |
||
my %sum2{Int}; |
my %sum2{Int}; |
||
for 1..MAX -> \i { |
|||
%po5{ |
%po5{i⁵} = i; |
||
for 1..MAX -> |
for 1..MAX -> \j { |
||
%sum2{ |
%sum2{i⁵ + j⁵} = i, j; |
||
} |
} |
||
} |
} |
||
%po5.keys.sort.race.map: -> \p { |
|||
% |
for %sum2.keys.sort -> \s { |
||
if p > s and %sum2{p - s} { |
|||
⚫ | |||
next if $p <= $s; |
|||
if %sum2{$p - $s} { |
|||
⚫ | |||
exit; |
|||
} |
} |
||
} |
} |
||
}</syntaxhighlight> |
}</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
<pre>27⁵ + 84⁵ + 110⁵ + 133⁵ = |
<pre>27⁵ + 84⁵ + 110⁵ + 133⁵ = 144⁵</pre> |
||
---- |
|||
=={{header|REXX}}== |
=={{header|REXX}}== |
||
=== fast computation === |
=== fast computation === |