next | previous | forward | backward | up | index | toc

# isPrime -- whether a integer or polynomial is prime

## Synopsis

• Usage:
isPrime f
• Inputs:
• Outputs:
• , true if f is either a prime integer or an irreducible polynomial and false otherwise

## Description

 i1 : ZZ/2[t]; i2 : isPrime(t^2+t+1) o2 = true i3 : isPrime(t^2+1) o3 = false i4 : isPrime 101 o4 = true i5 : isPrime 158174196546819165468118574681196546811856748118567481185669501856749 o5 = true i6 : isPrime 158174196546819165468118574681196546811856748118567481185669501856749^2 o6 = false

Since factor returns factors guaranteed only to be pseudoprimes, it may be useful to check their primality, as follows.

 i7 : f = factor 28752093487520394720397634653456 4 o7 = 2 109*1831*3014311519*2987077659845341 o7 : Expression of class Product i8 : peek'_2 f o8 = Product{Power{2, 4}, Power{109, 1}, Power{1831, 1}, Power{3014311519, ------------------------------------------------------------------------ 1}, Power{2987077659845341, 1}} i9 : first \ toList f o9 = {2, 109, 1831, 3014311519, 2987077659845341} o9 : List i10 : isPrime \ oo o10 = {true, true, true, true, true} o10 : List

Primality testing for integers is handled by FLINT.