(16C) Collatz conjecture
|
12-22-2021, 01:41 PM
Post: #1
|
|||
|
|||
(16C) Collatz conjecture
Starting with any positive integer, repeat the following operation
- If the number is even, divide it by two. - If the number is odd, triple it and add one. The conjecture is, this process will always reach the number one. The HP16-C has the shift an rotate operations in integer modes, which are useful for this kind of programs. Code: f SR Code: f SL Show the Collatz sequence: Code: 001 43,22, C g LBL C Usage: enter a positive number GSB C Example: 7 GSB C shows 7, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1, 0 |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
(16C) Collatz conjecture - wynen - 12-22-2021 01:41 PM
RE: (16C) Collatz conjecture - Maximilian Hohmann - 12-22-2021, 04:08 PM
|
User(s) browsing this thread: 1 Guest(s)