PLOTS OF GCD, LCM, REMAINDER, AND QUOTIENT
Below are 3D plots of the greatest common divisor, least common multiple, remainder, and integer quotient functions of nonnegative integers x and y. These plots were produced by Mathematica. For each function, two plots are shown, one for a word size of
three bits and the other for a word size of five bits.
This material was suggested by Guy Steele.
8
32
6
y
24
8
4
2
4
24
8
16
x
2
0
32
y 16
6
8
0
0
x
0
FIGURE 1. Plots of the greatest common divisor function GCD(x, y).
8
32
6
y
24
8
4
y
6
2
0
24
8
4
2
32
16
16
x
8
0
0
x
0
FIGURE 2. Plots of the least common multiple function LCM(x, y).
In Figure 2, the vertical scales are compressed; the highest peaks in the left figure are
of height LCM(6, 7) = 42.
1
32
8
24
6
y
8
4
4
2
32
y 16
6
24
16
8
x
2
x
8
0
0
FIGURE 3. Plots of the remainder function rem(x, y).
2
8
4
8
6
6
32
y
16
24
4
x
24
16
8
2
x
8
0
32
0
FIGURE 4. Plots of the integer quotient function x÷y.
Figure 4 is shown from a viewpoint different from that of the other figures.
2
y