ULAM  Using Ulam's Conjecture to determine the number of steps it takes to reduce an integer N to 1 using the following rules:
If N is odd: N = 3×N+1
If N is even: N=N/2
9/24/2013
Program:
EXPORT ULAM(N)
BEGIN
LOCAL C;
PRINT();
REPEAT
IF FP(N/2)==0 THEN
N:=N/2;
ELSE
N:=3*N+1;
END;
C:=C+1;
PRINT(N);
UNTIL N==1;
RETURN C;
END;
Examples:
ULAM(69): 208, 104, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1 (14 steps)
ULAM(84): 42, 21, 64, 32, 16, 8, 4, 2, 1 (9 steps)
This blog is property of Edward Shore. 2013
A blog is that is all about mathematics and calculators, two of my passions in life.
Wednesday, October 2, 2013
HP Prime Program: ULAM
Subscribe to:
Post Comments (Atom)
Retro Review: Texas Instruments TI68
Retro Review: Texas Instruments TI68 Company: Texas Instruments Years: 1989  2002 Type: Scientific, Formula Programmin...

Casio fx991EX Classwiz Review Casio FX991EX The next incarnation of the fx991 line of Casio calculators is the fx991 EX. ...

TI36X Pro Review This is a review of the TI36X Pro Calculator by Texas Instruments. History Originally, this was the TI30X Pro that w...

One of the missing features of the TI82/83/84 family is the ability to convert between bases. Here are two programs in TIBasic to help...
No comments:
Post a Comment