Hello Valentin,
Quote:
Very nice !
Thanks, but those two lines of mine are not nearly as nice as the other 17 ones of yours!
Here is my first attempt for the HP-12C. Took more than 5 minutes though :-)
01 ENTER
02 LN
03 LST x
04 .
05 5
06 +
07 *
08 x<>y
09 -
10 1
11 1
12 12/
13 +
14 1
15 0
16 LN
17 /
18 1
19 +
20 INTG
2 <= n <= 100,000,000 (wrong! see update below)
N = INT(1 + ((n + 1/2)*ln(n) - n + 11/12)/ln(10))
ln(sqrt(2*pi)) = 0.918938533
11/12 = 0.916666667
20 steps! Not so bad, considering the 12C lacks pi and common logarithm...
Best regards,
Gerson.
------------------------------------------------
Update:
Unfortunately, 11/12 is not good enough. The results are one unit less for N=197, 216, 1944, 2512, etc. 34/37 would raise the upper limit to 165534. And 1213/1320 would raise it to 2064172, but in this case it would be better go back to the original formula and start over. Approximating pi as 355/113 (8 steps) would not be of much help...
Edited: 22 Feb 2007, 6:08 p.m.