ggT: Calculates the greatest common divisor of two natural numbers...

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/ZFunktionen.r

Description

The function ggT calculates the greatest common divisor of two natural numbers. In this package it is called by the function kgV which calculates the least common multiple of two natural numbers. The latter is needed by the function zykloid and by the function npeaks which calculates the number of peaks (or loops) a cycloid has. As the greatest common divisor might be useful for other purposes, the function ggT is accessible to external use in this package.

Usage

1
ggT(a, b)

Arguments

a

A natural number (integer value > 0)

b

A natural number (integer value > 0)

Value

A natural number if a and b are natural numbers. In any other case, the function returns NA.

Author(s)

Peter Biber

References

Bronstein IN, Semendjaev KA, Musiol G, Muehlig H (2001): Taschenbuch der Mathematik, 5th Edition, Verlag Harri Deutsch, 1186 p. (p. 333)

http://en.wikipedia.org/wiki/Euclidean_algorithm

See Also

kgV, npeaks

Examples

1
2
3
4
5
6
7
8
ggT(18, 6)        # 6
ggT(38, 105)      # 1
ggT(36, 9)        # 9
ggT(12, 9)        # 3
ggT(9, 12)        # 3
ggT(-5, 12)       # NA - only integer numbers > 0 allowed
ggT(3, 0)         # NA - only integer numbers > 0 allowed
ggT(3.2, 12)      # NA - only integer numbers > 0 allowed

cycloids documentation built on May 30, 2017, 7:38 a.m.

Search within the cycloids package
Search all R packages, documentation and source code