Post Reply 
Tupper's 'Self-referencing' Formula
05-20-2022, 10:12 PM
Post: #8
RE: Tupper's 'Self-referencing' Formula
Okay, I think that translates as:

lsd(number,divisor)
BEGIN
LOCAL Q:="0";LOCAL R:=0;LOCAL R2:=0;LOCAL Q2:=0;LOCAL K=0;
FOR I FROM 1 TO size(number) DO
R2:=10*R+(number(I)-48);
Q2:=FLOOR(R2/divisor);
Q:=Q+STRING(Q2);
R:=R2-Q2*divisor;
END;
WHILE Q(1)==48 DO
Q:=RIGHT(Q,size(Q)-1);
END;
RETURN Q;
END;
That is 10 seconds faster for the purposes of this program, which is better.

My other version that uses a general division routine for the string integer division by 17 and then uses a special only divide by 2 routine for all of the binary divisions, is 50 seconds faster than your method in the same program.

Thanks for the info.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Tupper's 'Self-referencing' Formula - matalog - 05-20-2022 10:12 PM



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