Making Friends


This is a companion discussion topic for the original entry at https://toph.co/p/making-friends

This question is poorly worded. It is not clear whether N is the class size before or after Byang has joined the class.

Also, if you were to join a new school and try this method, I would be willing to bet that you would make precisely zero friends; there is a big leap between “Byang plans to make friends…” and “count how many friends he will make”. This requires clarification, such as “Assuming Byang is successful in making friends with everyone he wants to…”.

the entire math is not coded properly like what
I have to divide the input number of N by 2 3 5 or what

The problem is not described properly but the code is right … you have to count the divisors of N … and the number of divisors is the number of friends he will make… hope you’d understand…
Happy Coding !

According to the problem, if the number of students be 6 then Byang’s roll number should be 7 and in that case the output should be 1 since only 1 is divisor of 7 !!!

1 Like

TL;DR: I think the problem is properly described in the statement. We just have to think a bit to figure it out perfectly.

Everyone who’s confused about the number of students in the class and Byang’s roll number, just think deeply.

The value of N is 6 in the sample case. Firstly, let’s assume 6 is the number of students before Byang joined. So, his roll should be 7 (6+1). But, 7 is a prime number, and it has only one divisor except itself, which is 1. And 1 is certainly smaller than the sample output number, which is 3.
That means, it’s guaranteed that the number of students in the class (N) is including
Byang.

Figuring hidden things out of the problem statement is a part of the solution! :wink: