Prime visits, help me out

@lukharshiv,
https://ide.codingblocks.com/s/252724 corrected code

Your code had small errors. Overall logic was correct