Initial revision
[LeanCalc.git] / help / gcdrem
1 NAME
2     gcdrem - result of removing factors of integer common to a specified integer
3
4 SYNOPSIS
5     gcdrem(x, y)
6
7 TYPES
8     x           integer
9     y           integer
10
11     return      non-negative integer
12
13 DESCRIPTION
14
15     If x and y are not zero, gcdrem(x, y) returns the greatest integer
16     divisor d of x relatively prime to y, i.e. for which gcd(d,y) = 1.
17     In particular, gcdrem(x,y) = abs(x) if x and y are relatively
18     prime.
19
20     For all x, gcdrem(x, 0) = 1.
21
22     For all nonzero y, gcdrem(0, y) = 0.
23
24 PROPERTIES
25     gcdrem(x,y) = gcd(abs(x), abs(y)).
26
27     If x is not zero, gcdrem(x,y) = gcdrem(x, gcd(x,y)) = gcdrem(x, y % x).
28
29     For fixed nonzero x, gcdrem(x,y) is periodic with period abs(x).
30
31     gcdrem(x,y) = 1 if and only if every prime divisor of x
32         is a divisor of y.
33
34     If x is not zero, gcdrem(x,y) == abs(x) if and only if gcd(x,y) = 1.
35
36     If y is not zero and p_1, p_2, ..., p_k are the prime divisors of y,
37
38         gcdrem(x,y) = frem(...(frem(frem(x,p_1),p_2)...,p_k)
39
40 EXAMPLE
41     > print gcdrem(6,15), gcdrem(15,6), gcdrem(72,6), gcdrem(6,72)
42     2 5 1 1
43
44     > print gcdrem(630,6), gcdrem(6,630)
45     35 1
46
47 LIMITS
48     none
49
50 LINK LIBRARY
51     NUMBER *qgcdrem(NUMBER *x, NUMBER *y)
52
53 SEE ALSO
54     gcd, frem, isrel
55