summaryrefslogtreecommitdiff
path: root/factors/totative.go
AgeCommit message (Collapse)Author
2023-11-12Add per-file copyright notices & contact infoAdrien Hopkins
This is the safest thing to do to ensure my software is free while avoiding legal trouble ... hopefully, I'm not a lawyer!
2023-10-09factors: Give all exported members proper godocAdrien Hopkins
2023-10-09Add more tests & fix found bugsAdrien Hopkins
- TotativeDigits was defined incorrectly, previously counted totatives from 0 to r-1, now counts digits from 1 to r. This ensures that len(TotativeDigits(r)) = Totient(r).
2023-09-07Add ability to display specific totative digitsAdrien Hopkins
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.
2023-09-05Remove totative ratio from factors APIAdrien Hopkins
This value can easily be calculated as φ(r)/r. There is no need to have this now that I have a function φ(r) (renamed to its mathematical name, Totient). I removed totative ratio instead of totient because, while it is more important, totient is an integer while totative ratio is a float. This means that the totative ratio can be calculated exactly from the totient, but not the other way round.
2023-09-04Add totative digit count to non-compact outputAdrien Hopkins
This is done for a few reasons: - Allow the user to easily determine the exact value of the totative ratio - This information is important when the digit map isn't accessible (for radices >36) - More consistency with factors I don't show the exact values of totatives like I do with factors because they're far more common - the superior highly composite (i.e. one of the numbers with the highest factor count) number 720720 has 240 factors and 138240 totatives, for example.
2023-08-25Make totative ratio exactAdrien Hopkins
(or, as exact as possible within a float64 - I only do one float division, and everything else is a uint, so I think this means I will get the closest available float64 value every time)
2023-08-21Add totative ratio and factor score to programAdrien Hopkins