Re: Find the series

From: Darrell Grainger (darrell_at_NOMORESPAMcs.utoronto.ca.com)
Date: 11/20/03

  • Next message: Santosh: "Re: Choosing a DataStructure"
    Date: 20 Nov 2003 14:05:39 GMT
    
    

    On Sun, 16 Nov 2003, Sriram Krishnan wrote:

    > Richard Heathfield <dontmail@address.co.uk.invalid> wrote in message news:<bp78km$6bl$1@sparta.btinternet.com>...
    > > Sriram Krishnan wrote:
    > >
    > > > Given an arbitrary number series, how do I identify the series and
    > > > find the Nth number...
    > >
    > > Linear regression analysis.
    >
    >
    > Tried googling for it but couldnt find anything concrete(meaning stuff
    > I could understand). Could you point me to some code? And can I use
    > this method when my input series has only 3 to 4 numbers.
    >
    > That is, given 2,3,5,8 ...I should be able to determine that this is a
    > equation got by adding the previous two elements...and that too,that
    > the first element is not the first number in the series

    According to you the next series in this sequence is 13. I could just as
    easily argue that the next number in the sequence is 12. I say that the
    sequence is determined by adding the position of the number with the
    number to get the next (1 indexed). So 2 is in position 1, thus the next
    number is 2+1 or 3. The number 3 is in position 2, thus the next number is
    3+2 or 5. The number 5 is in position 3, thus the next number is 8. The
    number 8 is in position 4, thus the next number is 4+8 or 12.

    Just something to think about.

    > Thanks again...
    >
    > Maybe the next edition of C Unleashed should have a chapter on it :-)
    >
    > Regards,
    > Sriram
    >

    -- 
    Send e-mail to: darrell at cs dot toronto dot edu
    Don't send e-mail to vice.president@whitehouse.gov
    

  • Next message: Santosh: "Re: Choosing a DataStructure"