Finds the greatest common divisor (GCD) of two integers using a recursive approximation. In addition to the value of GCD, it generates the number of required iterations to find GCD.
Usage
GCD(x, y, k = 0)
Arguments
x
the first integer greater than zero.
y
the second integer greater than zero.
k
initial value for counting the number of steps. It must be set zero.
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(CryptRndTest)
Loading required package: MissMech
Loading required package: kSamples
Loading required package: SuppDists
Loading required package: sfsmisc
Loading required package: Rmpfr
Loading required package: gmp
Attaching package: 'gmp'
The following objects are masked from 'package:sfsmisc':
factorize, is.whole
The following objects are masked from 'package:base':
%*%, apply, crossprod, matrix, tcrossprod
C code of R package 'Rmpfr': GMP using 64 bits per limb
Attaching package: 'Rmpfr'
The following objects are masked from 'package:stats':
dbinom, dnorm, dpois, pnorm
The following objects are masked from 'package:base':
cbind, pmax, pmin, rbind
Loading required package: parallel
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/CryptRndTest/GCD.Rd_%03d_medium.png", width=480, height=480)
> ### Name: GCD
> ### Title: Greatest Common Divisor
> ### Aliases: GCD
>
> ### ** Examples
>
> result=GCD(4535,2451)
> print(result)
$k
[1] 7
$g
[1] 1
>
> result=GCD(35,2)
> print(result)
$k
[1] 2
$g
[1] 1
>
>
>
>
>
> dev.off()
null device
1
>