syraccuse
Created on Dec. 2, 2024 by 467
The Syracuse sequence is a mathematical sequence defined as follows:
U(0) = N
if U(n) is even:
U(n+1) = U(n)/2
otherwise:
U(n+1) = 3*U(n) + 1
You will be asked to write a program that reads a number as an argument to the program and returns all the terms in the sequence:
./syracuse 6
6 3 10 5 16 8 4 2 1
There's no corrections yet, hit the `Submit` button to send your code to the correction bot.
Keyboard shortcuts:
- Ctrl-Enter: Send your code to the correction bot.
- Escape: Get back to the instructions tab.