Difference between revisions of "Template:Gcd"

From blackwiki
Jump to navigation Jump to search
imported>Ezhiki
(trying out nested structure)
imported>Prolog
m (Removed protection from "Template:Gcd": Template has been deprecated)
 
(18 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{#ifexpr:{{{2}}}=0|{{{1}}}|{{#ifexpr:({{{1}}} mod {{{2}}})=0|{{{2}}}|{{#ifexpr:({{{2}}} mod ({{{1}}} mod {{{2}}}))=0|{{#expr:{{{1}}} mod {{{2}}}}}|{{#ifexpr:(({{{1}}} mod {{{2}}}) mod ({{{2}}} mod ({{{1}}} mod {{{2}}})))=0|{{#expr:({{{2}}} mod ({{{1}}} mod {{{2}}}))}}|{{ifexpr:((({{{2}}} mod ({{{1}}} mod {{{2}}})) mod (({{{1}}} mod {{{2}}}) mod ({{{2}}} mod ({{{1}}} mod {{{2}}})))))=0|{{#expr:(({{{1}}} mod {{{2}}}) mod ({{{2}}} mod ({{{1}}} mod {{{2}}})))}}|0}}}}}}}}}}
+
{{#invoke:math|gcd}}<noinclude>
 +
{{documentation}}
 +
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
 +
</noinclude>

Latest revision as of 21:16, 23 March 2017

Template documentation[view] [edit] [history] [purge]

This template calculates the greatest common divisor (gcd) of two or more parameters.

Examples

  • {{gcd|16|6}} → 2
  • {{gcd|360|180|120|90}} → 30
  • {{gcd|544|119}} → 17
  • {{gcd|2089|3571}} → 1