Back to Cosmos

Problem Link:

code/online_challenges/src/codechef/GUESSNUM/README.md

latest509 B
Original Source

Problem Link:

GUESSNUM

Description

Chef is playing a game with his brother Chefu. He asked Chefu to choose a positive integer N, multiply it by a given integer A, then choose a divisor of N (possibly N itself) and add it to the product. Let's denote the resulting integer by M; more formally, M=A⋅N+d, where d is some divisor of N.

Chefu told Chef the value of M and now, Chef should guess N. Help him find all values of N which Chefu could have chosen.