Learn R Programming

cycloids (version 1.0.2)

kgV: Calculates the least common multiple of two natural numbers a and b

Description

The function kgV calculates the least common multiple of two natural numbers. In this package it is used by the function zykloid and by the function npeaks which calculates the number of peaks (or loops) a cycloid has. As it might be useful for other purposes, it is externally available in this package.

Usage

kgV(a, b)

Value

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

Arguments

a

A natural number (integer value > 0)

b

A natural number (integer value > 0)

Author

Peter Biber

References

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

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

See Also

npeaks, ggT, zykloid

Examples

Run this code

kgV(18, 6)          #   18
kgV(38, 105)        # 3990
kgV(36, 9)          #   36
kgV(12, 9)          #   36
kgV(9, 12)          #   36
kgV(-5, 12)         # NA - only integer numbers > 0 allowed
kgV(3, 0)           # NA - only integer numbers > 0 allowed
kgV(3.2, 12)        # NA - only integer numbers > 0 allowed

Run the code above in your browser using DataLab