diff options
| author | Adrien Hopkins <adrien.p.hopkins@gmail.com> | 2023-09-07 13:15:40 -0500 |
|---|---|---|
| committer | Adrien Hopkins <adrien.p.hopkins@gmail.com> | 2023-09-07 13:15:40 -0500 |
| commit | 3cfb1fdcbe83c1ee4adf8e370f0922ca41c472c6 (patch) | |
| tree | 2695b9decec500c1c5137b79e8fd83a95961c2a0 /args.go | |
| parent | 7fa8cf9666cd3427dd078bb4a5fdb9fa30c94b09 (diff) | |
Add ability to display specific totative digits
Instead of just saying how many totative digits there are, the new -t
flag allows the user to determine the specific digits. All totatives
will end in one of these digits, and all primes are either factors or
totatives. This feature is not useful in comparing radices, only
learning one you have already chosen.
Because there can be so many totatives (p - 1 of them for primes!), this
is not displayed by default. The digit map (without -f) gives this
information, and beyond its range every number will have more than 8
totatives, so do not use this flag if you only want the count.
Diffstat (limited to 'args.go')
| -rw-r--r-- | args.go | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -11,10 +11,11 @@ const ProgramVersion = "1.0.0-alpha+dev" // The arguments to this program type args struct { - Radix uint - Compact bool - FullMap bool - ExactMTCLarge bool + Radix uint + Compact bool + FullMap bool + ExactMTCLarge bool + TotativeDigits bool // If true, exit the program immediately after parsing args. Exit bool } @@ -28,6 +29,8 @@ func parseArgs() (args, error) { flag.BoolVar(&a.ExactMTCLarge, "m", false, fmt.Sprintf("Calculate exact MTC for very large radices (up to %d instead of %d), which may take a while.", maxExtended, maxNormal)) + flag.BoolVar(&a.TotativeDigits, "t", false, + "Calculate the radix's totative digits instead of just how many there are; incompatible with -c.") help := flag.Bool("?", false, "Get information about program usage then exit") version := flag.Bool("V", false, @@ -40,6 +43,8 @@ func parseArgs() (args, error) { } else if *version { fmt.Println("Radix Info version", ProgramVersion) return args{Exit: true}, nil + } else if a.Compact && a.TotativeDigits { + return args{}, errors.New("You cannot use both -t and -c at the same time.") } else { if flag.NArg() == 1 { if radix, err := strconv.ParseUint(flag.Arg(0), 0, 0); err == nil { |
