This is the output I get in quotes with the below python code, however 6 is in the 6.txt file. How can I determine by print output if 6 is a perfect number or not? I know it is a perfect number!
"The number is not a Perfect number!
None"
Please Help I'm on to something big with easily determining Mersenne Prime Numbers. Once I have the below code fixed I can open large perfect numbers and then with my other py file I can differentiate between what numbers are perfect and not. The other code I will post here too after this is resolved and I will explain how its done. My other code is super fast at finding large perfect numbers!
"The number is not a Perfect number!
None"
Please Help I'm on to something big with easily determining Mersenne Prime Numbers. Once I have the below code fixed I can open large perfect numbers and then with my other py file I can differentiate between what numbers are perfect and not. The other code I will post here too after this is resolved and I will explain how its done. My other code is super fast at finding large perfect numbers!
KB = 1024 MB = 1024 * 1024 def perfect_number(file): for s in file: n = int(s) sum1 = 0 def n(): for i in range(1, n): if(n % i == 0): sum1 = sum1 + i if (sum1 == n): print ("The number is a Perfect number!" ) else: print("The number is not a Perfect number!") if __name__ == '__main__': with open('6.txt', buffering=1*MB) as bigggg: dr = file_perfect_number(bigggg) print(dr)