# SCM Repository

[inlinedocs] Diff of /pkg/inlinedocs/inst/testfiles/fermat.R
 [inlinedocs] / pkg / inlinedocs / inst / testfiles / fermat.R

# Diff of /pkg/inlinedocs/inst/testfiles/fermat.R

revision 114, Fri Jun 18 09:42:18 2010 UTC revision 115, Fri Jun 18 10:35:11 2010 UTC
# Line 38  Line 38
38    description="Fermat's little theorem states that if \\eqn{n} is a prime number\nand \\eqn{a} is any positive integer less than \\eqn{n}, then\n\\eqn{a} raised to the \\eqn{n}th power is congruent to \\eqn{a\\\nmodulo\\ n}{a modulo n}.",    description="Fermat's little theorem states that if \\eqn{n} is a prime number\nand \\eqn{a} is any positive integer less than \\eqn{n}, then\n\\eqn{a} raised to the \\eqn{n}th power is congruent to \\eqn{a\\\nmodulo\\ n}{a modulo n}.",
39    value="Whether the integer passes the Fermat test for a randomized\n\\eqn{0<a<n}",    value="Whether the integer passes the Fermat test for a randomized\n\\eqn{0<a<n}",
40    references="\\url{http://en.wikipedia.org/wiki/Fermat's_little_theorem}",    references="\\url{http://en.wikipedia.org/wiki/Fermat's_little_theorem}",
41    \\item{n}="the integer to test for primality.",    item{n}="the integer to test for primality.",
42    note="\\code{fermat.test} doesn't work for integers above\napproximately 15 because modulus loses precision."),    note="\\code{fermat.test} doesn't work for integers above\napproximately 15 because modulus loses precision."),
43                  is.pseudoprime=list(                  is.pseudoprime=list(
44    definition="is.pseudoprime <- function#Check an integer for pseudo-primality to an arbitrary precision.\n### A number is pseudo-prime if it is probably prime, the basis of\n### which is the probabalistic Fermat test; if it passes two such\n### tests, the chances are better than 3 out of 4 that \\eqn{n} is\n### prime.\n##references<< Abelson, Hal; Jerry Sussman, and Julie\n##Sussman. Structure and Interpretation of Computer\n##Programs. Cambridge: MIT Press, 1984.\n(n, ##<< the integer to test for pseudoprimality.\n times ##<< the number of Fermat tests to perform\n){\n  if(times==0)TRUE\n  ##seealso<< \\code{\\link{fermat.test}}\n  else if(fermat.test(n)) is.pseudoprime(n,times-1)\n  else FALSE\n### Whether the number is pseudoprime\n}",    definition="is.pseudoprime <- function#Check an integer for pseudo-primality to an arbitrary precision.\n### A number is pseudo-prime if it is probably prime, the basis of\n### which is the probabalistic Fermat test; if it passes two such\n### tests, the chances are better than 3 out of 4 that \\eqn{n} is\n### prime.\n##references<< Abelson, Hal; Jerry Sussman, and Julie\n##Sussman. Structure and Interpretation of Computer\n##Programs. Cambridge: MIT Press, 1984.\n(n, ##<< the integer to test for pseudoprimality.\n times ##<< the number of Fermat tests to perform\n){\n  if(times==0)TRUE\n  ##seealso<< \\code{\\link{fermat.test}}\n  else if(fermat.test(n)) is.pseudoprime(n,times-1)\n  else FALSE\n### Whether the number is pseudoprime\n}",
45    title="Check an integer for pseudo-primality to an arbitrary precision.",    title="Check an integer for pseudo-primality to an arbitrary precision.",
46    description="A number is pseudo-prime if it is probably prime, the basis of\nwhich is the probabalistic Fermat test; if it passes two such\ntests, the chances are better than 3 out of 4 that \\eqn{n} is\nprime.",    description="A number is pseudo-prime if it is probably prime, the basis of\nwhich is the probabalistic Fermat test; if it passes two such\ntests, the chances are better than 3 out of 4 that \\eqn{n} is\nprime.",
47    \\item{times}= "the number of Fermat tests to perform",    item{times}= "the number of Fermat tests to perform",
48    value="Whether the number is pseudoprime",    value="Whether the number is pseudoprime",
49    references="Abelson, Hal; Jerry Sussman, and Julie\nSussman. Structure and Interpretation of Computer\nPrograms. Cambridge: MIT Press, 1984.",    references="Abelson, Hal; Jerry Sussman, and Julie\nSussman. Structure and Interpretation of Computer\nPrograms. Cambridge: MIT Press, 1984.",
50    \\item{n}="the integer to test for pseudoprimality.",    item{n}="the integer to test for pseudoprimality.",