Neiron interview question

core java,Prime number code with 0(1) time complexity