2 gcdrem - result of removing factors of integer common to a specified integer
11 return non-negative integer
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
20 For all x, gcdrem(x, 0) = 1.
22 For all nonzero y, gcdrem(0, y) = 0.
25 gcdrem(x,y) = gcd(abs(x), abs(y)).
27 If x is not zero, gcdrem(x,y) = gcdrem(x, gcd(x,y)) = gcdrem(x, y % x).
29 For fixed nonzero x, gcdrem(x,y) is periodic with period abs(x).
31 gcdrem(x,y) = 1 if and only if every prime divisor of x
34 If x is not zero, gcdrem(x,y) == abs(x) if and only if gcd(x,y) = 1.
36 If y is not zero and p_1, p_2, ..., p_k are the prime divisors of y,
38 gcdrem(x,y) = frem(...(frem(frem(x,p_1),p_2)...,p_k)
41 ; print gcdrem(6,15), gcdrem(15,6), gcdrem(72,6), gcdrem(6,72)
44 ; print gcdrem(630,6), gcdrem(6,630)
51 NUMBER *qgcdrem(NUMBER *x, NUMBER *y)
56 ## Copyright (C) 1999 Landon Curt Noll
58 ## Calc is open software; you can redistribute it and/or modify it under
59 ## the terms of the version 2.1 of the GNU Lesser General Public License
60 ## as published by the Free Software Foundation.
62 ## Calc is distributed in the hope that it will be useful, but WITHOUT
63 ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
64 ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
65 ## Public License for more details.
67 ## A copy of version 2.1 of the GNU Lesser General Public License is
68 ## distributed with calc under the filename COPYING-LGPL. You should have
69 ## received a copy with calc; if not, write to Free Software Foundation, Inc.
70 ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
72 ## @(#) $Revision: 30.1 $
73 ## @(#) $Id: gcdrem,v 30.1 2007/03/16 11:10:42 chongo Exp $
74 ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/gcdrem,v $
76 ## Under source code control: 1995/12/18 12:03:02
77 ## File existed as early as: 1995
79 ## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
80 ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/