A positive integer m is perfect if the sum of all its positive divisors, 1 and m inclusive, is equal to 2m.
Determine the positive integers n such that nn+1 is a perfect number.
192 384 576
219 438 657
273 546 819
327 654 981
------ Python code follows ------
from itertools import permutations
nums = [1,2,3,4,5,6,7,8,9]
for j in permutations(nums):
x = 100*j[0] + 10*j[1] + j[2]
y = 100*j[3] + 10*j[4] + j[5]
z = 100*j[6] + 10*j[7] + j[8]
if z != 3*x:
continue
if y != z-x:
continue
print(x,y,z)
|
Posted by Larry
on 2021-02-26 16:29:58 |