Finding a pattern in a sequence of numbers

There are many numbers, all of them distributed from 0 to 12. How to write a program in delphi-7 to identify a formula, algorithm, pattern in the sequence of numbers, by which you can find the remaining numbers that obey this pattern? The numbers are entered from the keyboard until the pattern of the sequence of numbers is determined. And the following number is output to the text.

Author: angry, 2012-05-05

1 answers

In any case, nothing. Absolutely nothing. But you can try to guess the algorithm from existing ones.

  • methodo first. let's assume that the numbers obey some formula, for example n * a % b (where the percentage is taken modulo). As we enter the numbers, we try to find the coefficients. If it is possible for any of the formulas, it means that they have found it. The disadvantage is that you need to keep a database of formulas.
  • method two. Graphic. We simply build a graph based on these numbers, and put the ordinal one on the X-axis Number. We look at the graph, with a certain skill, you can guess the dependence. Then choose the formula purposefully.
  • method three. We plot the graph on the plane using pairs of numbers as the x,y coordinates or triples of numbers, then the third number is the color of the point. We look at the result. Some, not very good generators, immediately show "patterns". Based on this, you can guess the coordinates of the points.
 4
Author: KoVadim, 2012-05-05 17:05:33