add details to help

This commit is contained in:
filifa 2025-08-12 19:25:28 -04:00
parent cdb28018ac
commit 67a6ce9b69
1 changed files with 12 additions and 5 deletions

View File

@ -46,9 +46,16 @@ func isprime(cmd *cobra.Command, args []string) {
// isprimeCmd represents the isprime command
var isprimeCmd = &cobra.Command{
Use: "isprime",
Use: "isprime N [N ...]",
Short: "Determine whether a number is prime",
Long: `Determine whether a number is prime.`,
Long: `Determine whether a number is prime.
This applies 10 iterations of the Miller-Rabin test and a Baillie-PSW test. Use
flags to change the number of Miller-Rabin iterations.
For inputs less than 2^64, results are 100% accurate. For larger numbers, there
is a small chance of falsely reporting a composite number as prime. That chance
can be reduced by applying more rounds of Miller-Rabin.`,
Args: cobra.MinimumNArgs(1),
Run: isprime,
}
@ -66,5 +73,5 @@ func init() {
// is called directly, e.g.:
// isprimeCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
isprimeCmd.Flags().UintVarP(&rounds, "rounds", "r", 10, "number of iterations")
isprimeCmd.Flags().UintVarP(&rounds, "rounds", "r", 10, "number of iterations of Miller-Rabin test")
}