From 3b7fbea5f4b7b20564eba6d7a9a2420df4c0194f Mon Sep 17 00:00:00 2001 From: Patrick Simianer
Date: Wed, 20 Dec 2017 22:26:43 +0100 Subject: python/linear-log.py --- python/linear-log.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 python/linear-log.py 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))) + -- cgit v1.2.3