| Author |
Predict Sequence of Numbers?!
|
Shafian Kisna
Ranch Hand
Joined: Oct 25, 2005
Posts: 70
|
|
I have the following qn and I am in doubt how to get started. I have a few formulas but the problem is I am uncertain how to equate in Java. From the start program, I would provide a series of numbers and based on the numbers, I have to equate to see which best fits into the formula. It has to determine which type(s) of sequence these numbers could belong to, and in each case predict the next five numbers in the sequence. Formulas are Constant uk = a Arithmetic uk = uk-1+b Geometric uk = ruk-1 Recurrent uk = auk-1 + buk-2 + c Appreciate your help!!!
|
 |
Peter Chase
Ranch Hand
Joined: Oct 30, 2001
Posts: 1970
|
|
Sounds like a homework question and certainly not advanced Java - more like beginner. But it's Friday and I'm feeling generous, so some clues anyway... Look at the given numbers. If they're all the same, it's constant series. Look at the differences between the given numbers. If all the differences are the same, it's arithmetic. Look at the ratios of adjacent given numbers. If the ratios are all the same, it's geometric. Take care: if you use integer arithmetic, you could get false positives here. But if you use floating-point, you could get false negatives, unless you round appropriately.
|
Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.<br /> <br />#:^P
|
 |
 |
|
|
subject: Predict Sequence of Numbers?!
|
|
|