The "smallest but workable" is more hard task and required more effort to produce, I guess. Here are three from my head during last decade:
1.) Factorial (3 steps) for HP-12C for 1, 2, ..., 69 integers:
Factorial (3 steps) HP-12C
2.) GCD (8 steps) for HP15C without MOD:
GCD (Greatest Common Divisor) for HP-15C (8 steps) without MOD
3.) Linear regression coefficients (7 steps) for HP-12C:
Linear regression coefficients (7 steps) for HP-12C
+1 Bonus) Secant methon on CASIO fx-50F (14 steps)
Code:
The problem:
------------
Solving equations in f(x)=0 form
The solver equation:
--------------------
x[i+1]:= x[i]-f[i]×(x[i]-x[i-1])÷(f[i]-f[i-1])
The variables:
--------------
K1: x[i] (and then x[i+1])
K2: f[i]
K3: x[i-1]
K4: f[i-1]
The program:
------------
a.) The original version used the variables M, K1, K2, K3 and Kout/Kin commands instead of x<->K. This version was 17 steps and can be used for calculating inverse Normal distribution together with the built-in formulas. This shorter version use the K4 like the built-in Normal distribution, therefore it can not to use for calculating inverses (but easy to modify to M, K1, K2, K3 version).
b.) If you use only K variables and x<->K commands, the length can be reduced by 3 steps (-18% of program and 10% of total memory!):
P1: The secant step
P2: The f(x)
P1:
-----------
01: Kout1
-
x<->K3
)
×
Kout2
÷
(
Kout2
-
x<->K4
)
=
14: Kin-1
-----------
Usage:
------
a.) Type f(x) into P2
b.) Store x[0] into K1 and K3
c.) Run P2, with this step the f[0] calculated, store it into K4
d.) Store x[1] into K1
e.) Run P2, with this step the f[1] calculated and stored in K2
f.) Run P1, then P2. The display shows the f(x[i]) values
g.) Repeat f.) until the display shows a small or 0 value
Example 1:
==========
The problem:
------------
x^x=10^100; x=?
P2:
-----------
01: Kout1
×
log
-
100
=
Kin2 // The result f(x) must to store
-----------
Preparation:
------------
10 Kin1 Kin3 P2 Kin4 100 Kin1 P2
Running:
--------
P1 P2 on the display: -92.6
P1 P2 on the display: -10.1
P1 P2 on the display: 1.66
P1 P2 on the display: -0.014
P1 P2 on the display: -1.8E-05
P1 P2 on the display: 0
The result:
-----------
The result is in K1, the previous iteration in K3.
(Unfortunately K1 a little higher than the root, the K1^K1 is overflows, but K3 is OK.)
Kout1: 56.96124843(23)
Kout3: 56.96124013(76)
Example 2:
==========
The problem:
------------
x^3=3^x and x<3; x=?
P2:
-----------
01: Kout1
x^y
3
-
3
x^y
Kout1
=
Kin2
-----------
Preparation:
------------
2.5 Kin1 Kin3 P2 Kin4 2 Kin1 P2
Running:
--------
P1 P2 on the display: 7.3E-3
P1 P2 on the display: 1.4E-3
P1 P2 on the display: -6.2E-6
P1 P2 on the display: 5.1E-9
P1 P2 on the display: 0
The result:
-----------
Kout1: 2.478052680(32)
Kout3: 2.478052683(32)
nJoy!
Cs.