summaryrefslogtreecommitdiff
path: root/factors/totative.go
diff options
context:
space:
mode:
Diffstat (limited to 'factors/totative.go')
-rw-r--r--factors/totative.go14
1 files changed, 2 insertions, 12 deletions
diff --git a/factors/totative.go b/factors/totative.go
index 7a4bebe..680cc26 100644
--- a/factors/totative.go
+++ b/factors/totative.go
@@ -1,18 +1,8 @@
package factors
-// TotativeRatio calculates the fraction of numbers that
+// Totient calculates the number of numbers less than n that
// are totatives of n (share no factors with n)
-func TotativeRatio(n uint) float64 {
- if n == 0 {
- panic("0 has no totative ratio!")
- }
-
- return float64(TotativeCount(n)) / float64(n)
-}
-
-// TotativeCount calculates the number of numbers less than n that
-// are totatives of n (share no factors with n)
-func TotativeCount(n uint) uint {
+func Totient(n uint) uint {
if n == 0 {
return 0
}