2016-03-03 Exam, doubts and poetry#
This is one question we decided to remove from the final exam but I still do like it because it challenges people. How to make a connection between known algorithms and the following code. To your opinion, the following code is closed to:
import math
def meslogs_jusque(N):
memolog = { 1:0.0 }
for i in range(2,N+1):
if i in memolog:
pass
else:
l = math.log(i)
total = i
for j in range(total, N+1, total):
memolog[j] = memolog.get(j, 0.0) + l
total *= i
while total < N+1:
for j in range(total, N+1, total):
memolog[j] += l
total *= i
return memolog