(38 lines)
1 '\" t2 .\" Copyright (c) 2026 Bruce Hill3 .\" All rights reserved.4 .\"5 .TH Int.prev_prime 3 2026-01-19 "Tomo man-pages"6 .SH NAME7 Int.prev_prime \- get the previous prime8 .SH LIBRARY9 Tomo Standard Library10 .SH SYNOPSIS11 .nf12 .BI Int.prev_prime\ :\ func(x:\ Int\ ->\ Int?)13 .fi14 .SH DESCRIPTION15 Finds the previous prime number less than the given integer. If there is no previous prime number (i.e. if a number less than `2` is provided), then the function will create a runtime error.18 .SH ARGUMENTS20 .TS21 allbox;22 lb lb lbx23 l l l.24 Name Type Description25 x Int The integer before which to find the previous prime.26 .TE27 .SH RETURN28 The previous prime number less than `x`, or `none` if `x` is less than 2.30 .SH NOTES31 This function is _probabilistic_, but 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.33 .SH EXAMPLES34 .EX35 assert 11.prev_prime() == 736 .EE37 .SH SEE ALSO38 .BR Tomo-Int (3)