tracks/go/exercises/perfect-numbers/example.go in trackler-2.2.1.64 vs tracks/go/exercises/perfect-numbers/example.go in trackler-2.2.1.65
- old
+ new
@@ -16,15 +16,15 @@
var (
ErrOnlyPositive = errors.New("Positive number is required")
)
// Classify finds the category of given natural number
-func Classify(n uint64) (Classification, error) {
- if n == 0 {
+func Classify(n int64) (Classification, error) {
+ if n <= 0 {
return "", ErrOnlyPositive
}
- var sum uint64
- for i := uint64(1); i < n; i++ {
+ var sum int64
+ for i := int64(1); i < n; i++ {
if n%i == 0 {
if sum = sum + i; sum > n {
return ClassificationAbundant, nil
}
}