Take the 2-minute tour ×

How can we find a function for a conversion table with the following properties? The range of both inputs and outputs is $[0..100]$; inputs are integers.

$$f(0) = 0$$ $$f(100) = 100$$ $$f(1) - f(0) = 2(f(100) - f(99))$$

So, $f(1)$ should be $1.\bar3$ and $f(99)$ should be $99.\bar3$. The difference between subsequent outputs is linearly decreasing, so $f(50)-f(49)\approx 1$.

share|improve this question

1 Answer 1

up vote 5 down vote accepted

Let $a_n=f(n)-f(n-1)$. Then $a_1=\frac{4}{3}$ and $a_{100}=\frac{2}{3}$. Since the differences are linearly decreasing, we have $a_n=\frac{4}{3}-\frac{n-1}{99}\frac{2}{3}$.

Hence $f(n)=a_n+...+a_1+f(0)=\frac{4n}{3}-\frac{2}{297}(1+...+(n-1))=\frac{4n}{3}-\frac{n(n-1)}{297}=\frac{n(397-n)}{297}$.

share|improve this answer
Thank you very much. Now I can use the same logic to verify for different ratios (where ratio in my example was 2, between $f(1)-f(0)$ and $f(100)-f(99)$). –  ΤΖΩΤΖΙΟΥ Dec 12 '12 at 13:36
Thanks for the question edit, although outputs obviously aren't integers. I fixed that. –  ΤΖΩΤΖΙΟΥ Dec 13 '12 at 17:06

Your Answer


