summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--factors/factors_test.go22
1 files changed, 17 insertions, 5 deletions
diff --git a/factors/factors_test.go b/factors/factors_test.go
index 838186f..0952e8e 100644
--- a/factors/factors_test.go
+++ b/factors/factors_test.go
@@ -33,6 +33,7 @@ var primeFactorCases = map[uint]PrimeFactorization{
12: PrimeFactorization{map[uint]uint{2: 2, 3: 1}},
33: PrimeFactorization{map[uint]uint{3: 1, 11: 1}},
60: PrimeFactorization{map[uint]uint{2: 2, 3: 1, 5: 1}},
+ 71: PrimeFactorization{map[uint]uint{71: 1}},
86400: PrimeFactorization{map[uint]uint{2: 7, 3: 3, 5: 2}},
}
@@ -52,8 +53,11 @@ var factorCases = map[uint][]uint{
12: []uint{1, 2, 3, 4, 6, 12},
13: []uint{1, 13},
15: []uint{1, 3, 5, 15},
+ 16: []uint{1, 2, 4, 8, 16},
18: []uint{1, 2, 3, 6, 9, 18},
+ 30: []uint{1, 2, 3, 5, 6, 10, 15, 30},
60: []uint{1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30, 60},
+ 71: []uint{1, 71},
}
func TestFactors(t *testing.T) {
@@ -77,7 +81,7 @@ func TestTotativeRatio(t *testing.T) {
var totientCases = map[uint]uint{
0: 0, 1: 1, 2: 1, 3: 2, 4: 2, 6: 2, 7: 6, 8: 4, 12: 4,
- 14: 6, 15: 8, 30: 8, 60: 16, 120: 32,
+ 14: 6, 15: 8, 30: 8, 60: 16, 71: 70, 120: 32,
}
func TestTotativeCount(t *testing.T) {
@@ -93,6 +97,7 @@ var factorScoreCases = map[uint]float64{
8: 1.875,
10: 1.8,
12: 7.0 / 3.0,
+ 71: 72.0 / 71.0,
120: 3.0,
// number that will use bigScore
367567200: 62496.0 / 12155.0,
@@ -107,6 +112,10 @@ var basicRankCases = map[uint]string{
2: "D-", 3: "E-", 4: "C~", 5: "F+", 6: "B~",
7: "F-", 8: "C-", 9: "E~", 10: "D+", 11: "F~", 12: "A-",
14: "D~", 15: "E+", 18: "B-", 20: "C+", 24: "A~", 30: "B+", 60: "A+",
+ // test that it only depends on n%60
+ 62: "D-", 63: "E-", 64: "C~", 65: "F+", 66: "B~",
+ 67: "F-", 68: "C-", 69: "E~", 70: "D+", 71: "F~", 72: "A-",
+ 74: "D~", 75: "E+", 78: "B-", 80: "C+", 84: "A~", 90: "B+", 120: "A+",
}
func TestBasicRank(t *testing.T) {
@@ -119,6 +128,7 @@ var gcdCases = map[struct{ a, b uint32 }]uint32{
{12, 20}: 4, {20, 12}: 4,
{20, 55}: 5, {55, 20}: 5,
{60, 120}: 60, {120, 60}: 60,
+ {120, 180}: 60, {180, 120}: 60,
}
// a version of gcd() for testing purposes
@@ -190,10 +200,12 @@ var typeCases = map[uint]NumberType{
6: ColossallyAbundant, 8: OrderedExponent, 10: NotPractical,
12: ColossallyAbundant, 18: Practical, 20: Practical, 24: Superabundant,
28: Practical, 30: OrderedExponent, 31: NotPractical, 34: NotPractical,
- 60: ColossallyAbundant, 70: NotPractical, 90: Practical,
- 120: ColossallyAbundant, 240: Superabundant, 720: Superabundant,
- 770: NotPractical, 1729: NotPractical, 6912: OrderedExponent,
- 10010: NotPractical, 10080: Superabundant,
+ 60: ColossallyAbundant, 70: NotPractical, 90: Practical, 100: Practical,
+ 120: ColossallyAbundant, 144: OrderedExponent, 240: Superabundant,
+ 360: ColossallyAbundant, 720: Superabundant, 770: NotPractical,
+ 1729: NotPractical, 6912: OrderedExponent, 10010: NotPractical,
+ 10080: Superabundant, 15120: Superabundant, 25200: Superabundant,
+ 27720: Superabundant, 55440: ColossallyAbundant,
}
func TestType(t *testing.T) {