Least Common Multiples
This sketch was developed to meet Common Core math standard 6.NS.B: “Compute fluently with multi-digit numbers and find common factors and multiples.” In this project students write a program to find the least common multiple of two small numbers. The Hummingbird sensors are used to select the two numbers.
The Hummingbird controller consists of two rotary knobs attached to sensor ports 1 and 2. The output from these sensors is converted to an integer from 1 to 11 using the round block, as well as the subtraction and division operators.
The program uses a loop to find the least common multiple of the two numbers. It computes progressively larger multiples of the first number. For each multiple, the mod block is used to compute the remainder of the multiple divided by the second number. When the remainder is zero, the program has found the least common multiple.