Prime Visits My code isn't working can you tell me why?

My code isn’t working, can you tell me why?

@Udit-Sehra-2366292823468769 hey udit this question need high optimize method so implement this method using prime sieve.