Chef And Prime
CodeChefOpen on judge ↗
Chef Yakawaka gives you a simple problem on number theory. He gives you a number N.If this is a PRIME number then print this number on a new line as output.Otherwise, add the first prime number(2) to it and if it still remains a COMPOSITE number then add the 2nd prime number(3) to it and so on...until N becomes prime. As soon as N becomes PRIME print this number on a new line as output. Input
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start