Sum of divisors of a number

Revision en1, by Vectorrr, 2015-11-29 04:06:04

Hello everyone, I was trying to solve this problem but i couldnt handle it, could someone please help me? Given n 1 <= n <= 10^9 we have to find if there is a number which sum of divisors (including that number as a divisor) is equal to n and print it otherwise we have to print -1.

For example Input : 7; Output : 4, Since 7 = 4 + 2 + 1 Input : 1767 Output : 1225 Since 1767 = 1 + 5 + 7 + 25 + 35 + 49 + 175 + 245 + 1225

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English Vectorrr 2015-11-29 04:06:04 475 Initial revision (published)