Difference between revisions of "Template:Gcd"

From blackwiki
Jump to navigation Jump to search
imported>Ezhiki
(+examples)
imported>Ezhiki
m (cat sort key)
Line 6: Line 6:
 
*<nowiki>{{gcd|1787|853}}</nowiki>&nbsp;&rarr; {{gcd|1787|853}} (algorithm iteration limit reached)
 
*<nowiki>{{gcd|1787|853}}</nowiki>&nbsp;&rarr; {{gcd|1787|853}} (algorithm iteration limit reached)
  
[[Category:Mathematical function templates]]</noinclude>
+
[[Category:Mathematical function templates|GCD]]</noinclude>

Revision as of 17:29, 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).

Examples

  • {{gcd|16|6}} → 2
  • {{gcd|544|119}} → 17
  • {{gcd|1787|853}} → 0 (algorithm iteration limit reached)