Step Into Labs

Step Into C · Module exam · Control Flow

Exam: The Collatz Explorer

Follow a famous unsolved problem with a function, a loop and careful input checks.

Part of Step Into C. The full module exam, its missions and the real compiler and debugger are in the course. Try a free lesson first to see how it works.

Take any positive number. If it is even, halve it. If it is odd, triple it and add one. Repeat. Every number anyone has ever tried ends at 1, but nobody has proved that it always will: it is the Collatz conjecture. Build a tool that follows the path for any starting number and reports how long it took and how high it climbed.

In this module exam

Missions

  1. Follow the path to 1