dev
Download
40 lines 995 BGroffModified 2026-01-20 raw
12345678910111213141516171819202122232425262728293031323334353637383940
'\" t
.\" Copyright (c) 2026 Bruce Hill
.\" All rights reserved.
.\"
.TH Int.is_prime 3 2026-01-19 "Tomo man-pages"
.SH NAME
Int.is_prime \- check if an integer is prime
.SH LIBRARY
Tomo Standard Library
.SH SYNOPSIS
.nf
.BI Int.is_prime\ :\ func(x:\ Int,\ reps:\ Int\ =\ 50\ ->\ Bool)
.fi
.SH DESCRIPTION
Determines if an integer is a prime number.


.SH ARGUMENTS

.TS
allbox;
lb lb lbx lb
l l l l.
Name	Type	Description	Default
x	Int	The integer to be checked. 	-
reps	Int	The number of repetitions for primality tests. 	50
.TE
.SH RETURN
`yes` if `x` is a prime number, `no` otherwise.

.SH NOTES
This function is _probabilistic_. With the default arguments, the chances of getting an incorrect answer are astronomically small (on the order of 10^(-30)). See [the GNU MP docs](https://gmplib.org/manual/Number-Theoretic-Functions#index-mpz_005fprobab_005fprime_005fp) for more details.

.SH EXAMPLES
.EX
assert 7.is_prime() == yes
assert 6.is_prime() == no
.EE
.SH SEE ALSO
.BR Tomo-Int (3)