Prime visits problem

sir is this the correct approach to solve this ques

and sir what are the mistakes

hello @qudsiya
image
here u need to check whether j is prime or not.
if it is prime then only increment ur count.

mistake is in ur second loop.
check and correct it.