(34S) Collatz Conjecture
|
05-31-2014, 08:11 PM
(This post was last modified: 06-15-2017 01:20 PM by Gene.)
Post: #1
|
|||
|
|||
(34S) Collatz Conjecture
Briefly, the Collatz Conjecture states that you can start with any positive integer, and by repeating these two transformations, eventually arrive at 1:
1. If the number is even, divide it by 2. 2. If the number is odd, multiply it by 3 and add 1. Here's a simple program to evaluate such sequences, and report the number of transformations that were needed to reach 1, as well as the max value that was obtained along the way. Optionally, you can set flag 1 before execution to view the current value being updated in real-time (this slows the program down considerably, though). Input: X: Starting Value Output: Y: Maximum Value X: Number of Transformations Example: 27 XEQ'CTZ' In less than one second, you should see 111, the total number of transformations. Press x><y to see the max value, 9,232. Code: LBL 'CTZ' |
|||
05-31-2014, 08:44 PM
Post: #2
|
|||
|
|||
RE: (WP-34S) Collatz Conjecture
The Collatz Conjecture is also called the Syracuse problem.
Here is my version for the WP 34S in 19 steps: Code: 001 LBL A |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)