Doubt:Array and Prime divisors

how to solve the question of above link.
what i will store in each node of segment tree??

What makes you think to use segment tree. You only need to implement Sieve and check whether the number divides B and is also prime.

Sorry!! sir, other link was posted by mistake. Above is the link of the question in which i have doubt.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.