You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given a set of integers, this program calculates the sequence of numbers (steps) for each integer following the rules of [Collatz Conjecture](https://en.wikipedia.org/wiki/Collatz_conjecture):
23
+
24
+
* If the previous term is even, the next term is one half of the previous term (*n / 2*).
25
+
* If the previous term is odd, the next term is 3 times the previous term plus 1 (*3n + 1*).
This program was inspired by watching a [Youtube video](https://www.youtube.com/watch?v=094y1Z2wpJg&t=319s) from Veritasium about Collatz Conjecture, and implements a function to ouput the steps for a given set of integers and plot the results to a graph.
5
+
6
+
## Problem
7
+
8
+
This problem concerns any sequences of integers in which each term is obtained from the previous term as follows:
9
+
10
+
* If the previous term is even, the next term is one half of the previous term (*n / 2*).
11
+
* If the previous term is odd, the next term is 3 times the previous term plus 1 (*3n + 1*).
12
+
13
+
The conjecture is that these sequences always reach 1, no matter which positive integer is chosen to start the sequence.
Copy file name to clipboardExpand all lines: projects/prisoner_problem/README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
# 100 Prisoners Problem
2
-
Reference the [Wikipedia](https://en.wikipedia.org/wiki/100_prisoners_problem#:~:text=The%20100%20prisoners%20problem%20is,cannot%20communicate%20with%20other%20prisoners.) page.
2
+
Reference the [Wikipedia](https://en.wikipedia.org/wiki/100_prisoners_problem) page.
3
3
This program was inspired by watching a [Youtube video](https://www.youtube.com/watch?v=iSNsgj1OCLA) from Veritasium about the 100 Prisoner Problem, and tests the probabilities of the Loop Strategy described below.
0 commit comments