Math::...Proving(3pm)
π NAME π
Math::Prime::Util::PrimalityProving β bestie, this is the module that does primality proofs and certificates. Yes, actual proofs. Not vibes-based primality. Receipts-based primality. π
(it lives in the Perl user-contributed docs, section 3pm, so if you're hunting for it on your system that's where it's parked π)
β¨ VERSION β¨
Version 0.74 π¦
πΈ SYNOPSIS πΈ
okay so. not me noticing there is literally nothing here π the SYNOPSIS is empty, bestie. iconically minimalist of it. the real tea is all down in FUNCTIONS, so scroll down π«Ά
π§ DESCRIPTION π§
These are the routines that show up to support primality proofs and certificate verification. That's the whole vibe. π₯
π FUNCTIONS π
π primality_proof_lucas
Give it a positive number n and it does a full factorization of n-1, then attempts a Lucas test on the result. What you get back is a Pratt-style certificate π
β οΈ bestie listen. if the input is composite, this will take a very long time to return. like, go make a snack, watch a whole series, come back, it might still be going. π
π primality_proof_bls75
Give it a positive number n and it does a partial factorization of n-1, then attempts a proof using theorem 5 of Brillhart, Lehmer, and Selfridge's 1975 paper. π
This can take a long time to return if you hand it a composite too, lowkey β but it should not be anywhere near as long as the Lucas test. β¨
π convert_array_cert_to_string
Feed it a Perl structure certificate β the kind Math::Prime::Util used from version 0.26 through 0.29 β and it converts it into a multi-line text certificate that starts with:
[MPU - Primality Certificate]
This is the new format produced and processed by Math::Prime::Util, Math::Prime::Util::GMP, and the associated tools. glow-up complete π
π verify_cert
Takes an MPU primality certificate and verifies that it does prove the primality of the number it represents β that's the N sitting after the Proof for: line. π΅οΈ
For backwards compatibility, if you hand it an old-style Perl structure, it gets converted first and then verified. so generous of it π«Ά
The return value is:
0β failed to verify1β verified
π¨ IMPORTANT, no cap: a result of 0 does not mean the number is composite!! It only means the proof you gave it is not sufficient. do not go around calling numbers composite on this evidence, bestie.
If the certificate is malformed, the routine will carp a warning in addition to returning 0. π
If the verbose option is set (see prime_set_config), then when validation fails, the reason for the failure is printed in addition to returning 0. π
If the verbose option is set to 2 or higher, then a message indicating success and the certificate type is also printed. π
A later release may add support for Primo certificates β you can peek at it here: http://www.ellipsa.eu/public/primo/primo.html β because all the method verifications are already coded. π
π SEE ALSO π
Math::Prime::Util
π«Ά AUTHORS π«Ά
Dana Jacobsen <dana@acm.org> β the main character who wrote all of this π
π COPYRIGHT π
Copyright 2012-2013 by Dana Jacobsen <dana@acm.org>
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. π
and that's the whole page, bestie!! this one's from perl v5.42.3, dated 2026-08-20 β go forth and prove things, you absolute icon πβ¨π¦
π¦ where this page comes from
- ubuntu stonking: libmath-prime-util-perl 0.74-1build1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms