Tupper's 'Self-referencing' Formula
05-20-2022, 10:12 PM
Post: #8
 matalog Senior Member Posts: 349 Joined: May 2021
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.
 « Next Oldest | Next Newest »

 Messages In This Thread Tupper's 'Self-referencing' Formula - matalog - 05-19-2022, 02:31 PM RE: Tupper's 'Self-referencing' Formula - OlidaBel - 05-19-2022, 08:15 PM RE: Tupper's 'Self-referencing' Formula - matalog - 05-20-2022, 08:43 AM RE: Tupper's 'Self-referencing' Formula - jte - 05-19-2022, 10:43 PM RE: Tupper's 'Self-referencing' Formula - Albert Chan - 05-20-2022, 03:04 PM RE: Tupper's 'Self-referencing' Formula - matalog - 05-20-2022, 08:46 PM RE: Tupper's 'Self-referencing' Formula - Albert Chan - 05-20-2022, 08:55 PM RE: Tupper's 'Self-referencing' Formula - matalog - 05-20-2022 10:12 PM

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