From 67a6ce9b69d5f0f6380b111fd3dac42446359bb6 Mon Sep 17 00:00:00 2001 From: filifa Date: Tue, 12 Aug 2025 19:25:28 -0400 Subject: [PATCH] add details to help --- cmd/isprime.go | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/cmd/isprime.go b/cmd/isprime.go index 7392ead..af07f16 100644 --- a/cmd/isprime.go +++ b/cmd/isprime.go @@ -46,11 +46,18 @@ 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.`, - Args: cobra.MinimumNArgs(1), - Run: isprime, + 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, } func init() { @@ -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") }