Difference between revisions of "Template:Gcd"
Jump to navigation
Jump to search
imported>Ezhiki (added another level) |
imported>Ezhiki (+brief doc) |
||
| 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}}})))}}|{{#ifexpr:((({{{1}}} mod {{{2}}}) mod ({{{2}}} mod ({{{1}}} mod {{{2}}}))) mod (({{{2}}} mod ({{{1}}} mod {{{2}}})) mod (({{{1}}} mod {{{2}}}) mod ({{{2}}} mod ({{{1}}} mod {{{2}}})))))=0|{{#expr:(({{{2}}} mod ({{{1}}} mod {{{2}}})) mod (({{{1}}} mod {{{2}}}) mod ({{{2}}} mod ({{{1}}} mod {{{2}}}))))}}|0}}}}}}}}}}}} | + | <includeonly>{{#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}}})))}}|{{#ifexpr:((({{{1}}} mod {{{2}}}) mod ({{{2}}} mod ({{{1}}} mod {{{2}}}))) mod (({{{2}}} mod ({{{1}}} mod {{{2}}})) mod (({{{1}}} mod {{{2}}}) mod ({{{2}}} mod ({{{1}}} mod {{{2}}})))))=0|{{#expr:(({{{2}}} mod ({{{1}}} mod {{{2}}})) mod (({{{1}}} mod {{{2}}}) mod ({{{2}}} mod ({{{1}}} mod {{{2}}}))))}}|0}}}}}}}}}}}}</includeonly><noinclude>This template calculates the '''[[greatest common divisor]]''' (gcd) of two parameters. It returns the value of gcd. Zero is returned when calculation is too complex (this implementation only allows for six iterations of the [[Euclidean algorithm]]). |
| + | |||
| + | [[Category:Mathematical function templates]]</noinclude> | ||
Revision as of 17:25, 3 August 2007
This template calculates the greatest common divisor (gcd) of two parameters. It returns the value of gcd. Zero is returned when calculation is too complex (this implementation only allows for six iterations of the Euclidean algorithm).