Module:MOS: Difference between revisions
m Replacing the algorithm in `brightest_mode()` with the "Christoffel word walk" algorithm which is always linear time. |
No edit summary |
||
| Line 142: | Line 142: | ||
local current_L, current_s = 0, 0 | local current_L, current_s = 0, 0 | ||
local result = '' | local result = '' | ||
while current_L < | while current_L < nL or current_s < ns do | ||
if (current_s + 1) * | if (current_s + 1) * nL <= ns * (current_L) then | ||
current_s = current_s + 1 | current_s = current_s + 1 | ||
result = result .. 's' | result = result .. 's' | ||