Smallest multiple: Difference between revisions

m
→‎{{header|Wren}}: Changed to Wren S/H
No edit summary
m (→‎{{header|Wren}}: Changed to Wren S/H)
 
(3 intermediate revisions by 3 users not shown)
Line 376:
200 -> 337293588832926264639465766794841407432394382785157234228847021917234018060677390066992000
2000 -> 151117794877444315307536308337572822173736308853579339903227904473000476322347234655122160866668946941993951014270933512030194957221371956828843521568082173786251242333157830450435623211664308500316844478617809101158220672108895053508829266120497031742749376045929890296052805527212315382805219353316270742572401962035464878235703759464796806075131056520079836955770415021318508272982103736658633390411347759000563271226062182345964184167346918225243856348794013355418404695826256911622054015423611375261945905974225257659010379414787547681984112941581325198396634685659217861208771400322507388161967513719166366839894214040787733471287845629833993885413462225294548785581641804620417256563685280586511301918399010451347815776570842790738545306707750937624267501103840324470083425714138183905657667736579430274197734179172691637931540695631396056193786415805463680000</pre>
 
=={{header|J}}==
<syntaxhighlight lang="j"> *./ >: i. 20
232792560</syntaxhighlight>
 
=={{header|jq}}==
Line 928 ⟶ 932:
232792560
done...
</pre>
=={{header|RPL}}==
{{trans|BASIC}}
≪ 2 3 * 5 * 7 * 9 * 11 * 13 * 17 * 19 * → t
≪ t 2 20 '''FOR''' lim
'''IF''' DUP lim MOD '''THEN''' 1 'lim' STO t + '''END NEXT'''
≫ ≫ '<span style="color:blue">TASK</span>' STO
With <code>LCM</code> defined at [[Least common multiple#RPL|Least common multiple]]:
≪ 1 2 20 '''FOR''' n n <span style="color:blue">LCM</span> '''NEXT''' ≫ '<span style="color:blue">TASK</span>' STO
{{out}}
<pre>
1: 232792560
</pre>
 
=={{header|Ruby}}==
<syntaxhighlight lang="ruby">
[10, 20, 200, 2000].each {|n| puts "#{n}: #{(1..n).inject(&:lcm)}" }</syntaxhighlight>
{{out}}
<pre>10: 2520
20: 232792560
200: 337293588832926264639465766794841407432394382785157234228847021917234018060677390066992000
2000: 151117794877444315307536308337572822173736308853579339903227904473000476322347234655122160866668946941993951014270933512030194957221371956828843521568082173786251242333157830450435623211664308500316844478617809101158220672108895053508829266120497031742749376045929890296052805527212315382805219353316270742572401962035464878235703759464796806075131056520079836955770415021318508272982103736658633390411347759000563271226062182345964184167346918225243856348794013355418404695826256911622054015423611375261945905974225257659010379414787547681984112941581325198396634685659217861208771400322507388161967513719166366839894214040787733471287845629833993885413462225294548785581641804620417256563685280586511301918399010451347815776570842790738545306707750937624267501103840324470083425714138183905657667736579430274197734179172691637931540695631396056193786415805463680000
</pre>
 
Line 964 ⟶ 990:
 
More formally and quite quick by Wren standards at 0.017 seconds:
<syntaxhighlight lang="ecmascriptwren">import "./math" for Int
import "./big" for BigInt
import "./fmt" for Fmt
9,476

edits