summaryrefslogtreecommitdiff
path: root/python/linear-log.py
blob: 6863b2c0480fbbfdd7a9341ce3d727d6aba6fb48 (plain)
1
2
3
4
5
6
7
8
9
10
11
import math

def f(n):
    x = n/1000.0
    if x > 10:
        x = 10 + math.log(x**3)
    return min(100, max(1, int(x)))

for i in [1,5,10,500,1000,5000,10000,50000,100000,500000,1000000,10000000]:
    print("%d --- %d"%(i,f(i)))