summaryrefslogtreecommitdiff
path: root/radix_info.go
diff options
context:
space:
mode:
Diffstat (limited to 'radix_info.go')
-rw-r--r--radix_info.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/radix_info.go b/radix_info.go
index 770fd42..4194a2c 100644
--- a/radix_info.go
+++ b/radix_info.go
@@ -12,12 +12,16 @@ func main() {
if len(os.Args) > 1 {
if n, err := strconv.ParseUint(os.Args[1], 0, 0); err == nil {
if n > 1 {
- fmt.Printf("%d = %s\n", n, factors.PrimeFactorize(uint(n)))
- n_factors := factors.Factors(uint(n))
+ n := uint(n)
+ fmt.Printf("%d = %s\n", n, factors.PrimeFactorize(n))
+ n_factors := factors.Factors(n)
sort.Slice(n_factors, func(i, j int) bool {
return n_factors[i] < n_factors[j]
})
- fmt.Printf("Factors: %v\n", n_factors)
+ factorScore := factors.Score(n)
+ fmt.Printf("Factors: %v (Score: %.2f)\n", n_factors, factorScore)
+ fmt.Printf("Totative Ratio: %03.1f%%\n",
+ factors.TotativeRatio(n)*100.0)
} else {
fmt.Println("Argument must be an integer above 1.")
}