in reply to A script to determine the next number in a sequence

Anonymous Monk,
There is the integer sequence database which may help but you have to understand that this is an impossible problem. For a given number of integers in a sequence, there are an infinite number of "formulas" that could produce that sequence. Each may produce a different "next number". All you could hope to accomplish with a program is to find a formula that fits the data, you have no guarantees it is the right one.

My guess for the next number is 62.5, can you figure out why?

Cheers - L~R

  • Comment on Re: A script to determine the next number in a sequence

Replies are listed 'Best First'.
Re^2: A script to determine the next number in a sequence
by ambrus (Abbot) on May 10, 2007 at 18:00 UTC

    My guess is 76, from polynomial inerpolation -- a lousy method for this but I like it. Sloane says it's either 100 or 65.

Re^2: A script to determine the next number in a sequence
by monarch (Priest) on May 10, 2007 at 15:41 UTC
    I was unable to get 62.5.

    My only guess is

    1 x(5/1) =5 x2 =10 x(5/2) = 25 x2 =50 x(5/3) =83.3

    In other words, a sequence of two stages:

    • multiply by (5 divided by n++)
    • multiply by 2

      monarch,
      The approach I used is that each term was being multiplied by some number. There were two patterns of multiples woven together. One pattern was constant - x 2. The other depends on the previous value (prev / 2).
      1 x 5 = 5 # pattern 1, no prev value so start with 5 5 x 2 = 10 # pattern 2, constant 10 x 2.5 = 25 # pattern 1, prev value 5 / 2 25 x 2 = 50 # pattern 2, constant 50 x 1.25 = 62.5 # pattern 1, prev value 2.5 / 2

      Cheers - L~R

        Nice observation!

        Just goes to show, there were definitely multiple answers to this question..