numtheory - Maple Programming Help

Home : Support : Online Help : Mathematics : Group Theory : Numbers : numtheory/fermat

numtheory

 fermat
 nth Fermat number

 Calling Sequence fermat(n) fermat(n, w)

Parameters

 n - (optional) non-negative integer w - (optional) unassigned variable

Description

 • The nth Fermat number is ${2}^{{2}^{n}}+1$.
 • fermat(n) returns the nth Fermat number, for $n<22$.
 • For any non-negative integer n and unassigned variable w, the function call fermat(n, w) assigns to w the information which is known (at the time of writing this function) about the Fermat number fermat(n).  This information consists of: the primality character of fermat(n) (prime, composite, or unknown), and, if it is composite, any known prime factors.
 • Every factor of a Fermat number fermat(n) has the form ${2}^{n+2}k+1,2\le k$.
 • If fermat is invoked with no arguments, it returns a list of all Fermat numbers whose primality status is known as of the time when this function was written.
 • The command with(numtheory,fermat) allows the use of the abbreviated form of this command.

Examples

 > $\mathrm{with}\left(\mathrm{numtheory}\right):$
 > $\mathrm{fermat}\left(n\right)$
 ${{2}}^{{{2}}^{{n}}}{+}{1}$ (1)
 > $\mathrm{fermat}\left(0\right)$
 ${3}$ (2)
 > $\mathrm{fermat}\left(3\right)$
 ${257}$ (3)
 > $\mathrm{fermat}\left(4,'w'\right)$
 ${65537}$ (4)
 > $w$
 ${\mathrm{it is prime}}$ (5)
 > $\mathrm{fermat}\left(6,'w'\right)$
 ${18446744073709551617}$ (6)
 > $w$
 ${\mathrm{it is completely factored}}{,}{}\left({{}\left({2}\right)}^{{8}}{}{{}\left({3}\right)}^{{2}}{}{}\left({7}\right){}{}\left({17}\right){+}{1}\right){}{}\left({{}\left({2}\right)}^{{8}}{}{}\left({5}\right){}{}\left({47}\right){}{}\left({373}\right){}{}\left({2998279}\right){+}{1}\right)$ (7)
 > $\mathrm{length}\left(\mathrm{fermat}\left(20\right)\right)$
 ${315653}$ (8)
 > $\mathrm{fermat}\left(30,'w'\right)$
 ${\mathrm{object too big}}$ (9)
 > $w$
 ${\mathrm{it has these prime factors}}{,}{{}\left({2}\right)}^{{33}}{}{}\left({127589}\right){+}{1}{,}{{}\left({2}\right)}^{{32}}{}{}\left({149041}\right){+}{1}$ (10)
 > $\mathrm{fermat}\left(9448,'w'\right)$
 ${\mathrm{object too big}}$ (11)
 > $w$
 ${\mathrm{it has this prime factor}}{,}{}\left({19}\right){}{{}\left({2}\right)}^{{9450}}{+}{1}$ (12)
 > $\mathrm{fermat}\left(10000\right)$
 ${\mathrm{character unknown}}$ (13)