I am doing a website and I need an algorithm. I am not so good in math, that is why I come here for help. It is, from my point, for a mathematician very easy.
Here's the deal :
IF X IS BETWEEN 0 AND 9
Y = 2
IF X IS BETWEEN 10 AND 19
Y = 4
IF X IS BETWEEN 20 AND 39
Y = 8
IF X IS BETWEEN 40 AND 79
Y = 16
IF X IS BETWEEN 80 AND 159
Y = 32
ETC...
Anyone can help by doing a simple algorithm ? You can use any functions you want or whatever. Thanks a lot !
EDIT: It is possible to change the interval between X but it need to start low and be higher then Y and has to give similar results.