summaryrefslogtreecommitdiff
path: root/factors/totative.go
diff options
context:
space:
mode:
authorAdrien Hopkins <adrien.p.hopkins@gmail.com>2023-10-09 16:15:48 -0500
committerAdrien Hopkins <adrien.p.hopkins@gmail.com>2023-10-09 16:16:29 -0500
commitc50ece109cdb29ab5d3fa7444040b546da7e360c (patch)
tree33fbf5678f2030a85f6c4b4f20ff5fc302516c53 /factors/totative.go
parentdbd02c8437ae634f4ece3c2979afeb19a3979f61 (diff)
factors: Give all exported members proper godoc
Diffstat (limited to 'factors/totative.go')
-rw-r--r--factors/totative.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/factors/totative.go b/factors/totative.go
index d1947b6..9dde4b0 100644
--- a/factors/totative.go
+++ b/factors/totative.go
@@ -1,7 +1,7 @@
package factors
// Totient calculates the number of numbers between 1 and n inclusive
-// that are totatives of n (share no factors with n)
+// that are totatives of n (share no factors with n).
func Totient(n uint) uint {
if n == 0 {
return 0
@@ -20,6 +20,8 @@ func Totient(n uint) uint {
// TotativeDigits returns a slice containing every number between 1 and r
// inclusive that is a totative of r (shares no factors with r).
+//
+// The returned slice's length is [Totient](r).
func TotativeDigits(r uint32) []uint32 {
digits := make([]uint32, Totient(uint(r)))
totativesFound := 0