Skip to content

Commit 2d26738

Browse files
tasxatzialIsaacG
andauthored
Reframe collatz-conjecture exercise instructions as a story (#2508)
* split into introduction and instructions * update metadata * make instructions more clear * incorporate forum suggestions * fix lint errors * Apply suggestions from code review Co-authored-by: Isaac Good <[email protected]> --------- Co-authored-by: Isaac Good <[email protected]>
1 parent d11557d commit 2d26738

File tree

4 files changed

+33
-31
lines changed

4 files changed

+33
-31
lines changed

exercises/collatz-conjecture/description.md

Lines changed: 0 additions & 29 deletions
This file was deleted.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Instructions
2+
3+
Given a positive integer, return the number of steps it takes to reach 1 according to the rules of the Collatz Conjecture.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Introduction
2+
3+
One evening, you stumbled upon an old notebook filled with cryptic scribbles, as though someone had been obsessively chasing an idea.
4+
On one page, a single question stood out: **Can every number find its way to 1?**
5+
It was tied to something called the **Collatz Conjecture**, a puzzle that has baffled thinkers for decades.
6+
7+
The rules were deceptively simple.
8+
Pick any positive integer.
9+
10+
- If it's even, divide it by 2.
11+
- If it's odd, multiply it by 3 and add 1.
12+
13+
Then, repeat these steps with the result, continuing indefinitely.
14+
15+
Curious, you picked number 12 to test and began the journey:
16+
17+
12 ➜ 6 ➜ 3 ➜ 10 ➜ 5 ➜ 16 ➜ 8 ➜ 4 ➜ 2 ➜ 1
18+
19+
Counting from the second number (6), it took 9 steps to reach 1, and each time the rules repeated, the number kept changing.
20+
At first, the sequence seemed unpredictable — jumping up, down, and all over.
21+
Yet, the conjecture claims that no matter the starting number, we'll always end at 1.
22+
23+
It was fascinating, but also puzzling.
24+
Why does this always seem to work?
25+
Could there be a number where the process breaks down, looping forever or escaping into infinity?
26+
The notebook suggested solving this could reveal something profound — and with it, fame, [fortune][collatz-prize], and a place in history awaits whoever could unlock its secrets.
27+
28+
[collatz-prize]: https://mathprize.net/posts/collatz-conjecture/
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
title = "Collatz Conjecture"
22
blurb = "Calculate the number of steps to reach 1 using the Collatz conjecture."
3-
source = "An unsolved problem in mathematics named after mathematician Lothar Collatz"
4-
source_url = "https://en.wikipedia.org/wiki/3x_%2B_1_problem"
3+
source = "Wikipedia"
4+
source_url = "https://en.wikipedia.org/wiki/Collatz_conjecture"

0 commit comments

Comments
 (0)