aspose file tools
The moose likes Java in General and the fly likes Predict Sequence of Numbers?! Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Predict Sequence of Numbers?!" Watch "Predict Sequence of Numbers?!" New topic
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Predict Sequence of Numbers?!
 
Similar Threads
quadruple
Java formulas in xml format
How to calculate productivity and duration
comparing arraylist elements
comparing arraylist elements