Help needed with codeforces problem?



I know how to solve this problem Perfect Number in a brute force way but the tags on that page show binary search and DP as well. I am curious to know how this problem can be solved using Binary search and DP. Can someone help me with this please?


Can someone help please??


Read the comments here:
They discussed the binary search and other solutions to the problem. Tell me if you are not able to understand, then I’ll explain the soultion here