ScaLAPACK 2.1  2.1
ScaLAPACK: Scalable Linear Algebra PACKage
ilcm.f
Go to the documentation of this file.
1  INTEGER FUNCTION ilcm( M, N )
2 *
3 * -- ScaLAPACK tools routine (version 1.7) --
4 * University of Tennessee, Knoxville, Oak Ridge National Laboratory,
5 * and University of California, Berkeley.
6 * May 1, 1997
7 *
8 * .. Scalar Arguments ..
9  INTEGER m, n
10 * ..
11 *
12 * Purpose
13 * =======
14 *
15 * ILCM computes and returns the Least Common Multiple (LCM) of two
16 * positive integers M and N. In fact the routine computes the greatest
17 * common divisor (GCD) and use the fact that M*N = GCD*LCM.
18 *
19 * Arguments
20 * =========
21 *
22 * M (input) INTEGER
23 * On entry, M >=0. Unchanged on exit.
24 *
25 * N (input) INTEGER
26 * On entry, N >=0. Unchanged on exit.
27 *
28 * =====================================================================
29 *
30 * .. Local Scalars ..
31  INTEGER ia, iq, ir
32 * ..
33 * .. Executable Statements ..
34 *
35  IF( m.GE.n ) THEN
36  ia = m
37  ilcm = n
38  ELSE
39  ia = n
40  ilcm = m
41  ENDIF
42 *
43  10 CONTINUE
44  iq = ia / ilcm
45  ir = ia - iq * ilcm
46  IF( ir.EQ.0 ) THEN
47  ilcm = ( m * n ) / ilcm
48  RETURN
49  END IF
50  ia = ilcm
51  ilcm = ir
52  GO TO 10
53 *
54 * End of ILCM
55 *
56  END
ilcm
integer function ilcm(M, N)
Definition: ilcm.f:2