# reversing a progression

This topic is 4240 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Let's say I have
x(i) = x(i-1) * 2 + 50

x0 =   0          =   0
x1 =   0 * 2 + 50 =  50
x2 =  50 * 2 + 50 = 150
x3 = 150 * 2 + 50 = 350
x4 = 350 * 2 + 50 = 750

If I have a "score" = 175, what is the formula to give me the index of the immediate lower term, ie. 2? I need this to compute the "rank" of a player, depending on the score. Thanks!

##### Share on other sites

x(i) = (2^i-1)*50

so we have the equation:

(2^i-1)*50 = score

i = floor(log(score/50+1))

##### Share on other sites
floor(log_2(score / 50 + 1))

edit: beaten

##### Share on other sites
Thank you for the quick reply, I've already put it in practice [smile]

##### Share on other sites
That's all good and well provided you can write the formula in a closed form, but if the recurrence-relation isn't so simple, you'll just have to hope and pray that you can rearrange it, like:

x(i) = x(i-1) * 2 + 50
x(i) - 50 = x(i-1)
(x(i) - 50) / 2 = x(i-1)

so

x(i) = (x(i+1) - 50) / 2

This way you can throw the current score in and get the preceding value out, without having to invert or look-up.

1. 1
2. 2
3. 3
Rutin
18
4. 4
5. 5
frob
12

• 9
• 18
• 9
• 31
• 16
• ### Forum Statistics

• Total Topics
632617
• Total Posts
3007455

×