File Password From Divisor Sum

Company: SwissRe

Difficulty: easy

Problem Statement

File Password From Divisor Sum John, an information security consultant, recently joined an organization. He noticed that employees were sending files as email attachments without any password protection. He advised them to protect their files with a password, and emphasized that the password must never be shared in the same email. His recommendation was to use a number as the password of the file. To make this workable, John suggested placing a number N in the body of the email. A client who wants to open the attachment identifies every number that evenly divides N , and the sum of those divisors is the password of the file. As a software developer in the organization, you have been asked to build the component that takes N and reports the corresponding password. Given N , print the sum of all of its divisors. A number d is a divisor of N when N leaves no remainder on division by d . (inferred — the source states "all the numbers that can evenly divide N", and the skeleton shipped wit