Learn R Programming

modiscloud (version 0.14)

fermat.test: Test an integer for primality with Fermat's little theorem

Description

This is an example function for making R packages and R documentation with roxygen2 and roxygenize.

Usage

fermat.test(n)

Arguments

n
the integer to test for primality

Value

Whether the integer passes the Fermat test for a randomized $0 < a < n$ no workyATcallGraphPrimitives

Details

Fermat's little theorem states that if $n$ is a prime number and $a$ is any positive integer less than $n$, then $a$ raised to the $n$th power is congruent to $a modulo n$.

References

http://en.wikipedia.org/wiki/Fermat's_little_theorem