diff options
author | Patrick Simianer <p@simianer.de> | 2017-12-20 22:26:43 +0100 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2017-12-20 22:26:43 +0100 |
commit | 3b7fbea5f4b7b20564eba6d7a9a2420df4c0194f (patch) | |
tree | f231ea84732cd7b9cdeb6aa4159bbf4943b34643 | |
parent | 1295f932d74950acbb131ff2b587081c86e4e758 (diff) |
python/linear-log.py
-rw-r--r-- | python/linear-log.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/python/linear-log.py b/python/linear-log.py new file mode 100644 index 0000000..6863b2c --- /dev/null +++ b/python/linear-log.py @@ -0,0 +1,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))) + |