Jump to content

Perfect numbers: Difference between revisions

Go solution
(Go solution)
Line 306:
<lang gap>Filtered([1 .. 10000], n -> Sum(DivisorsInt(n)) = 2*n);
# [ 6, 28, 496, 8128 ]</lang>
=={{header|Go}}==
<lang go>func isPerfect(n int64) bool {
for _, p := range []int64{6, 28, 496, 8128, 33550336,
8589869056, 137438691328, 2305843008139952128} {
if n == p {
return true
}
}
return false
}</lang>
 
=={{header|Groovy}}==
1,707

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.