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!