Tupper's 'Self-referencing' Formula
|
05-20-2022, 03:04 PM
Post: #5
|
|||
|
|||
RE: Tupper's 'Self-referencing' Formula
Hi, matalog
Instead of removing leading zeroes of quotient up-front, it may be simpler to fix afterwards. Getting a quotient automatically generated remainder (for free), we might as well return both. Code: function divmod(num, den) -- NOTE: num = string of digits Note that r2 does not involve mod function, thus more efficient. If we don't care about quotient leading zeroes, after for-end loop, we can simply return q, r lua> divmod('12345678901234567890', 111) 111222332443554665 75 |
|||
« 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: 3 Guest(s)