Lowest Common Multiplier
by Isai Damier, Android Engineer @ Google

/**************************************************************************
 * Author: Isai Damier
 * Title: Lowest Common Multiplier
 * Project: geekviewpoint
 * Package: algorithms
 *
 * Statement:
 *  Find the lowest common multiplier of the given numbers
 *
 * Sample Input: 24, 16
 * Sample Output: 48
 *
 * Description: This function computes the lowest common multiplier of two
 *   given numbers. The lcm of two numbers a and b is the smallest number
 *   that can be divided by both a and b. For example, 15 is the lcm of 3
 *   and 5 because 15 is the lowest number that can be evenly devided by
 *   both 3 and 5; 18 is the lcm of 6 and 9 because 18 is the lowest number
 *   that can be divided by both 6 and 9.
 *
 * Technical Details: Mumerous techniques have been developed to
 *   compute the lcm of two numbers. The present algorithm uses
 *   (a*b)/gcd(a,b) = lcm (a,b).
 *
 **************************************************************************/ 
 public int LCM(int a, int b) {
  if (a > b) {
    return (a / GCD(a, b) * b);
  } else {
    return (b / GCD(a, b) * a);
  }
}
import org.junit.Test;
import static org.junit.Assert.*;

public class NumbersTest {

  /**
   * Test of LCM method, of class Numbers.
   */
  @Test
  public void testLCM() {
    System.out.println("LCM");
    Numbers lowestCommonMultiplier = new Numbers();
    assertEquals(48, lowestCommonMultiplier.LCM(24, 16));
    assertEquals(48, lowestCommonMultiplier.LCM(16, 24));
    assertEquals(16, lowestCommonMultiplier.LCM(16, 16));
    assertEquals(13*29, lowestCommonMultiplier.LCM(13, 29));
    assertEquals(100, lowestCommonMultiplier.LCM(100, 10));
  }
}