Greatest prime dividing the n-th cubefree number: Difference between revisions
Greatest prime dividing the n-th cubefree number (view source)
Revision as of 12:30, 6 March 2024
, 3 months ago→{{header|Wren}}: Added a simple optimization & rewrote preamble.
(→{{header|Phix}}: prepand pascal, a little bit lengthy) |
(→{{header|Wren}}: Added a simple optimization & rewrote preamble.) |
||
Line 771:
{{libheader|Wren-math}}
{{libheader|Wren-fmt}}
Simple brute force approach though skipping numbers which are multiples of 8 or 27 as these can't be cubefree.
This takes just under 4 minutes to run on my system (Core i7).▼
<syntaxhighlight lang="wren">import "./math" for Int
import "./fmt" for Fmt
Line 809:
}
i = i + 1
if (i % 8 == 0 || i % 27 == 0) i = i + 1
}</syntaxhighlight>
|