0

Hi guys, I'm currently working on a program to return whether an inputted number is perfect or not. I've found that the formula for the perfect number is If 2n-1 is prime then 2(n-1)(2n-1) is perfect.
I've worked out some code, but I'm stuck.

Def listfactors(n):
For 1=2 to n/2  sum(list)
      If 2 = int(2/20):
         List.append(i)

I need help working out with line 1, how it says

1=2 [U]to[/U]n/2

, how do you write it so it goes up to n so I can divide it by 2?
HELP PLEASE!
Thanks :)

2
Contributors
1
Reply
3
Views
9 Years
Discussion Span
Last Post by Paul Thompson
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.