Post Reply 
[VA] SRC #012c - Then and Now: Sum
12-03-2022, 07:41 PM
Post: #30
RE: [VA] SRC #012c - Then and Now: Sum
(12-03-2022 05:30 PM)Albert Chan Wrote:  10 DESTROY ALL @ L2=LN(2) @ SETTIME 0
20 DEF FNB(N)=IP(LN(N+.5)/L2)+1 ! BITS OF INTEGER N
30 DEF FNF(N) @ F=2 @ WHILE N>2 @ F=F*N @ N=FNB(N) @ END WHILE @ FNF=F @ END DEF
40 DEF FNG(N) @ G=0 @ N=2^N-1 @ Y=N*(N-1) ! SUM IN PAIRS
50 FOR X=N+N-1 TO N STEP -4 @ G=G+X/Y @ Y=Y-X-X+4 @ NEXT X @ FNG=G @ END DEF
60 DEF FNZ(N) @ IF N<5 THEN Z=FNG(N)-L2 @ GOTO 80
70 Z=.5^(N+1) @ Z2=Z*Z @ Z=(((-272*Z2+16)*Z2-2)*Z2+1)*Z2+Z
80 FNZ=Z/FNF(N) @ END DEF
100 S=1/4 @ I=1 @ REPEAT @ I=I+1 @ P=S @ S=S+FNZ(I) @ UNTIL P=S
110 DISP S/(1-L2)+1,I,TIME

>run
 2.086377665      31      0.1

Emu/DOS WinXP ≈ 200X --> HP71B runtime about 20 seconds.

Runs in 19.9s on a real HP-71B :-)

J-F
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: [VA] SRC #012c - Then and Now: Sum - J-F Garnier - 12-03-2022 07:41 PM



User(s) browsing this thread: 8 Guest(s)