-
-
Notifications
You must be signed in to change notification settings - Fork 544
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <IsaacG@users.noreply.github.com> --------- Co-authored-by: Isaac Good <IsaacG@users.noreply.github.com>
- Loading branch information
1 parent
d11557d
commit 2d26738
Showing
4 changed files
with
33 additions
and
31 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Instructions | ||
|
||
Given a positive integer, return the number of steps it takes to reach 1 according to the rules of the Collatz Conjecture. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Introduction | ||
|
||
One evening, you stumbled upon an old notebook filled with cryptic scribbles, as though someone had been obsessively chasing an idea. | ||
On one page, a single question stood out: **Can every number find its way to 1?** | ||
It was tied to something called the **Collatz Conjecture**, a puzzle that has baffled thinkers for decades. | ||
|
||
The rules were deceptively simple. | ||
Pick any positive integer. | ||
|
||
- If it's even, divide it by 2. | ||
- If it's odd, multiply it by 3 and add 1. | ||
|
||
Then, repeat these steps with the result, continuing indefinitely. | ||
|
||
Curious, you picked number 12 to test and began the journey: | ||
|
||
12 ➜ 6 ➜ 3 ➜ 10 ➜ 5 ➜ 16 ➜ 8 ➜ 4 ➜ 2 ➜ 1 | ||
|
||
Counting from the second number (6), it took 9 steps to reach 1, and each time the rules repeated, the number kept changing. | ||
At first, the sequence seemed unpredictable — jumping up, down, and all over. | ||
Yet, the conjecture claims that no matter the starting number, we'll always end at 1. | ||
|
||
It was fascinating, but also puzzling. | ||
Why does this always seem to work? | ||
Could there be a number where the process breaks down, looping forever or escaping into infinity? | ||
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. | ||
|
||
[collatz-prize]: https://mathprize.net/posts/collatz-conjecture/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
title = "Collatz Conjecture" | ||
blurb = "Calculate the number of steps to reach 1 using the Collatz conjecture." | ||
source = "An unsolved problem in mathematics named after mathematician Lothar Collatz" | ||
source_url = "https://en.wikipedia.org/wiki/3x_%2B_1_problem" | ||
source = "Wikipedia" | ||
source_url = "https://en.wikipedia.org/wiki/Collatz_conjecture" |