Prime & A Magic Sequence
CodeChefOpen on judge ↗
A famous mathematician proposed a series of numbers. According to the mathematician, for any positive integer number it is probable to make a succession of numbers that will finally end in number one (i.e., 1) by following a simple rule to generate the next number; if the starting number is even divide it by two, if it is odd multiply it by three and then add one (e.g., starting with number 5 the
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