Trilogy Innovations Coding Round doubt (Had test 2 3 days back).
Anonymous User
7500

n (no. of boxes) and b (random no). are given. Starting from box 1, 2, 3, 4....... till n , Find the no. of boxes containing prime no.
No. contained in the box is calculated by : Eg- for 2nd box :
no. that is in the box (Lets say y) = 2! + b (ith box! + b )
We need to find out how many boxes contain y as a prime no.

Constraints:
1<=n<=10^6
2<=b<=15

Test Case 1-
Input-> n= 2 , b=3
Output->1

Explanation- no. in the boxes are 1!+3= 4 and 2!+ 3= 5
Since 5 is the only prime. So output = 1

Comments (2)