NumberTheory
IthFermat
Fermat numbers
Calling Sequence
Parameters
Description
Examples
Compatibility
IthFermat(i)
IthFermat(i, output)
i
-
non-negative integer
output
(optional) equation of the form output=format where format can be value, prime, completelyfactored, factors, record, or a list of these terms.
The IthFermat(i) command returns the ith Fermat number.
Fermat numbers are of the form 22i+1 where i is a non-negative integer.
The output option specifies the format of the returned solution. This option can be an equation of the form output=format or output=list, where format can be any one of the following:
value : Returns the value of the ith Fermat number. This is the default output format.
prime : Returns true, false, or FAIL, depending on whether the primality of the ith Fermat is known.
completelyfactored : Returns true, false or FAIL depending on whether the ith fermat has been completely factored or not. If FAIL is returned, the character of the ith Fermat is unknown.
factors : Returns the prime factors for the ith Fermat number, if they are known. If the ith Fermat number is prime, [] is returned. Otherwise, the factors are unknown.
record : Returns a record containing all of the above output options. Each of the outputs can be queried using :-outputname.
Alternatively, output can be set to a list containing any of these formats. In this case, a sequence corresponding to the formats in the list is returned. Note that the output option is effective only if the parameter i is an integer; in all other cases, it is ignored.
with⁡NumberTheory:
The IthFermat command returns the value of the ith Fermat number:
IthFermat⁡0
3
Fermat numbers are of the form 22i+1:
220+1
There are five known prime Fermat numbers:
seq⁡IthFermat⁡i,i=0..4
3,5,17,257,65537
More details on Fermat numbers can be found using the output option:
IthFermat⁡1,output=prime
true
To get more information about a given Fermat number, use the list form of the output option.
IthFermat⁡3,output=prime,value,completelyfactored
true,257,true
Most Fermat numbers are composite. A full record of information can be returned using record as the output option:
F__5≔IthFermat⁡5,output=record
F__5≔Record⁡value=4294967297,prime=false,completelyfactored=true,factors=27⁢5+1⁢27⁢3⁢17449+1
F__5:-value
4294967297
F__5:-prime
false
F__5:-factors
27⁢5+1⁢27⁢3⁢17449+1
Check a known factor of F_49093. (Use expand to undo the factorization of the factor.)
f≔IthFermat⁡49093,output=factors
f≔3⁢5⁢11⁢249095+1
f≔expand⁡f1:
2&ˆ249093+1modf
0
Data frames are useful for capturing information about Fermat numbers:
FermatDF≔n↦DataFrame⁡seq⁡2`2`i+1,iinn|seq⁡length⁡IthFermat⁡i,iinn|seq⁡IthFermat⁡i,output=prime,iinn|seq⁡IthFermat⁡i,output=completelyfactored,iinn,rows=op⁡n,columns=F__n,`# of digits`,Prime,`Completely Factored`:
FermatDF⁡seq⁡0..7
F__n# of digitsPrimeCompletely Factored031truetrue122+11truetrue2222+12truetrue3223+13truetrue4224+15truetrue5225+110falsetrue6226+120falsetrue7227+139falsetrue
FermatDF⁡19
F__n# of digitsPrimeCompletely Factored192219+1157827falsefalse
GetRow⁡FermatDF⁡21,1
F__n2221+1# of digits631306PrimefalseCompletely Factoredfalse
The NumberTheory[IthFermat] command was introduced in Maple 2017.
For more information on Maple 2017 changes, see Updates in Maple 2017.
See Also
expand
mod
NumberTheory[IthMersenne]
Download Help Document