A Program Showing the Collatz Sequence On A SwissMicros DM32 (HP 32S II) Calculator

LBL C
ENTER
ENTER
STO A
RCL A
2
÷
FP {see hint below}
2
x
X=0?
GTO D
GTO E
LBL D
RCL A
2
÷
PSE
STO A
1
X<>Y
X≤Y?
GTO F
GTO C
LBL E
RCL A
3
x
1
+
PSE
STO A
GTO C
LBL F
RCL A

Enter a start number and XEQ C. Then it shows the numbers of the sequence, in this case 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1.

The original program was posted here:

https://www.hpmuseum.org/forum/thread-11015.html?highlight=Collatz

Thanks go out to Gamo, one of the senior members of the MoHPC!

The command FP can be found under the blue PARTS key (white SQRT) where it appears in the menu.

Leave a comment

A WordPress.com Website.