(HP-65) Collatz Conjecture
|
01-08-2020, 07:03 PM
Post: #1
|
|||
|
|||
(HP-65) Collatz Conjecture
Yeah, it's been done a million times before, but just for posterity...
Basic premise: The Collatz Conjecture states that you can start from any positive integer; if it's even, divide it by 2, and if it's odd, multiply by 3 and add 1. Continue this sequence, and you will always eventually reach 1. Usage Enter a positive integer in X, press A, and the program will tell you the number of steps required to reach 1 starting from your number. If you set flag 1 before running the program, it will stop to display each number in the sequence. Press R/S to calculate the next number. Code: LBL 23 If you don't need the ability to set flag 1 to view the sequence, you can omit these four steps shortly after LBL 2 for a roughly 9% speed up: f, TF 1, R/S, NOP |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
(HP-65) Collatz Conjecture - Dave Britten - 01-08-2020 07:03 PM
|
User(s) browsing this thread: 1 Guest(s)