2016 Update
This commit is contained in:
parent
948b86eafa
commit
dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions
|
|
@ -2,6 +2,16 @@ package main
|
|||
|
||||
import "fmt"
|
||||
|
||||
func computePerfect(n int64) bool {
|
||||
var sum int64
|
||||
for i := int64(1); i < n; i++ {
|
||||
if n%i == 0 {
|
||||
sum += i
|
||||
}
|
||||
}
|
||||
return sum == n
|
||||
}
|
||||
|
||||
// following function satisfies the task, returning true for all
|
||||
// perfect numbers representable in the argument type
|
||||
func isPerfect(n int64) bool {
|
||||
|
|
@ -24,13 +34,3 @@ func main() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
func computePerfect(n int64) bool {
|
||||
var sum int64
|
||||
for i := int64(1); i < n; i++ {
|
||||
if n%i == 0 {
|
||||
sum += i
|
||||
}
|
||||
}
|
||||
return sum == n
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue