Inspired from programming-algorithms.net/article... Takes less than 1sec to get to 137438691328 but can't find easily 2305843008139952128
from math import sqrt def perfect(n) : s = 1 rac = int(sqrt(n)) for k in range(2, rac+2) : if n%k == 0 : s += k + n//k return s == n def f(x) : return (2**(x-1))*((2**x)-1) n = 137438691329 m = 1 res = [] while True : val = f(m) print(val) if perfect(val) : res.append(val) m+=1 if val > n : break print(res)
site is great for algo, thanks.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Inspired from programming-algorithms.net/article...
Takes less than 1sec to get to 137438691328 but can't find easily 2305843008139952128
site is great for algo, thanks.