Hi,

wouldn't it be enough for simple purposes (as stated in the original
message: "Greatest common divisor of two numbers") to use:

gcd <- function(a,b) ifelse (b==0, a, gcd(b, a %% b))

> gcd(12,4)
[1] 4
> gcd(4,12)
[1] 4
> gcd(123456789,987654321)
[1] 9
> gcd(987654321,123456789)
[1] 9
>

Best,
Roland



On 4/17/07, Patrick Burns <[EMAIL PROTECTED]> wrote:
>
> S Poetry has a function for that.
>
>
> Patrick Burns
> [EMAIL PROTECTED]
> +44 (0)20 8525 0696
> http://www.burns-stat.com
> (home of S Poetry and "A Guide for the Unwilling S User")
>
> AbouEl-Makarim Aboueissa wrote:
>
> >Dear Sir/Madam:
> >
> >Could you please let me know which function shall I use to get the
> >Greatest common divisor of two numbers.
> >
> >Thank you so much for your attention to this matter, and i look forward
> >to hear from you soon.
> >
> >Regards;
> >
> >Abou
> >
> >
> >==========================
> >AbouEl-Makarim Aboueissa, Ph.D.
> >Assistant Professor of Statistics
> >Department of Mathematics & Statistics
> >University of Southern Maine
> >96 Falmouth Street
> >P.O. Box 9300
> >Portland, ME 04104-9300
> >
> >Tel: (207) 228-8389
> >Email: [EMAIL PROTECTED]
> >          [EMAIL PROTECTED]
> >Office: 301C Payson Smith
> >
> >______________________________________________
> >[email protected] mailing list
> >https://stat.ethz.ch/mailman/listinfo/r-help
> >PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> >and provide commented, minimal, self-contained, reproducible code.
> >
> >
> >
> >
>
> ______________________________________________
> [email protected] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to