user1015711
user1015711

Reputation: 132

Function to decode a series of numbers

I have a set of numbers that goes 99 170 270 410 606 880 1265. When a function that takes the difference of item n and n+1 to get n+2 it doesnt seem accurate as there common difference seems to be another set of numbers itself. Can anyone predict the next 50 numbers or suggest an improvement to my algorithm?

Upvotes: 0

Views: 344

Answers (2)

Conor Linehan
Conor Linehan

Reputation: 448

Try fitting it to a geometric sequence. Written in c++

int a = 99;
double r = (double)99/170;

for (int i = 0; i < 56; i++)
  {
    cout << a*(pow(r,i) << endl;
  }

Upvotes: 0

pentadecagon
pentadecagon

Reputation: 4847

Try quotient instead of difference, corresponding to an exponential relation: X[n+2] = X[n+1] * (X[n+1] / X[n]). Not perfect either, but a considerable improvement.

Upvotes: 2

Related Questions