P
P
plr2012-09-19 22:51:28
Mathematics
plr, 2012-09-19 22:51:28

Find a pattern between numbers?

There are initial numbers, 5 pieces, on their basis the sixth number is formed. There are no other variables besides 5 numbers, but there may be constants.
Actions between 5 numbers are not known, the algorithm is not available. Actions can be of any nature, not only mathematical ones, but, for example, a bit-by-bit shift, something even more tricky, etc.
There are 5 examples and the resulting numbers have more numbers. Those. the algorithm can produce them indefinitely.
Is it possible to determine the algorithm and dependencies without reverse engineering the existing code?
At least in theory I want to understand whether it is possible to solve this problem?

Answer the question

In order to leave comments, you need to log in

12 answer(s)
L
LeoCcoder, 2012-09-19
@LeoCcoder

impossible to solve in your problem statement.
You say that there are 5 numbers, that is, we know x1, x2, x3, x4, x5. There is an unknown arbitrary function F that calculates x6 = F(x1, x2, x3, x4, x5).
Task: Guess F and value x6.
xDDD

S
sergeypid, 2012-09-20
@sergeypid

This is a task for a genetic algorithm. It is described and there is a source code in the book “Programming the Collective Mind”, look for it. Brief essence of the algorithm: mathematical operations are represented as a tree. For example, A + B is a tree at the root of the addition operation, two leaves of the tree A and B. Operation A * 2 + B is a tree at the root +, on the left (left operand) - Multiplication, on the right B. The “multiplication” node is again divided into two branches - on the left A on the right 2. Well, in general, you understand. We randomly generate a population and run a genetic algorithm. Types of mutations - copying and rearranging subtrees. The survival function is how well the resulting mathematical expression correctly finds the sixth term for each of your training sequences.
I tried this source code on simple examples, such as guessing formulas of this kind “A * 4 + B * 9” - the solution is found quite quickly on training sets of 100 examples. If you have a sufficient number of training examples, there is a chance that it will find a solution in your case. Please write. results if you do.

A
Andrew, 2012-09-19
@xmdy

Maybe an approximation will help you ?
True, it is powerless before permuting the numbers in the resulting number))

I
ixSci, 2012-09-20
@ixSci

Well, in theory, everything is possible. You have a good base: source - result. Therefore, armed with a cryptanalyst, this problem can be solved, in theory. In practice, you can come up with a very complex algorithm that is unlikely to be solved or possible, but with the involvement of such funds that the task is not worth it.
In addition, if the function is a black box for you, where did you get the idea that x7 is not used there, equal to the phase of Jupiter at a given, specific, moment in time.
Such tasks, nevertheless, are easier to solve by reverse, unless, of course, a certain pattern is immediately guessed there.

V
Vyacheslav Golovanov, 2012-09-19
@SLY_G

Well, if only the task was formulated more clearly.
“There are no other variables besides 5 numbers, but there may be constants.” Are constants not numbers?
“Actions can be of any nature, not only mathematical” - I can’t imagine non-mathematical actions on numbers. Number is a mathematical abstraction. A bitwise shift is a multiplication by a power of 2, for example, ...
Unless, like in that children's problem, non-mathematical operations on numbers are when the eight corresponds to two, because there are two circles in the eight. But if this is such an algorithm, then of course it is hardly possible to pick it up ...
If you came up with a problem out of your head, you need to formulate it more strictly.

M
mr_idiot, 2012-09-19
@mr_idiot

You can try to guess. It is impossible to determine exactly.

0
0leGG, 2012-09-19
@0leGG

Well, at least for any x1..x5, it is possible to construct for any possible x6 a 5th degree polynomial passing through all these points, so it is not possible to predict anything without additional data.

F
FanKiLL, 2012-09-20
@FanKiLL

You can provide at least 1 row of numbers, and preferably a row of 3, in theory it is possible, if the 6th number is not random, but performed according to some algorithm, then it can be calculated in theory.
Can you ask these 5 numbers yourself? Or are they issued together with the 6th number already?

N
nickme, 2012-09-20
@nickme

It seems to me that any sixth number can be added to the given five numbers - there will definitely be a pattern (and not one, but infinitely many) ... For example, consider the numbers 1, 2, 3, 4, 5:

  • x 6 \u003d 1, because 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, ...
  • x 6 =2 because 1, 2, 3, 4, 5, 2, 3, 4, 5, 6, 3, 4, 5, 6, 7, ...
  • x 6 \u003d 3, because 1, 2, 3, 4, 5, 3, 4, 5, 6, 7, 5, 6, 7, 8, 9, ...
  • x 6 =4 because 1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3...
  • x 6 =5 because 1, 2, 3, 4, 5, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, ...

Well, etc. In other words, knowing the first n members of a number sequence does not determine all of its other members.
Another thing is when it comes to standard sequences. For example, there is such an online dictionary of sequences where you can enter the first few numbers and the system will return which of the known sequences begin with such numbers.

G
GavriKos, 2012-09-20
@GavriKos

Without known options for action between numbers, no. But if you can limit their number, you can try to pick up the function of the gene. algorithm. Those. a task of the form “given 5 numbers, arrange arithmetic operations between them so that the sixth number is obtained” gene. can be easily solved by the algorithm.

V
Vampiro, 2012-09-20
@Vampiro

If the result is a number, and the spread of the five inputs is small enough, I would build tables like this to start with:

0+0-0+0-0=0
1+0-0+0-0=1
2+0-0+0-0=2
.....
0+1-0+0-0=1
.....
0+0-1+0-0=-1
.......


It is clear that arithmetic operations are unknown to you, but such a table itself, in which there will be final results when one parameter is varied, leaving the others unchanged, can prompt you to think. Without such data, I have little idea of ​​what can be done except for approximation by polynomials, and even then I will have to collect a decent number of points.

P
Petrify, 2012-09-20
@Petrify

With an infinite output of 5:1 sets by the algorithm, it is possible to reduce the problem to 1:1, i.e. find many sets where only one variable changes, the rest are constants. In fact, we get F(x)=y, where x and y are known. the inverse function can be obtained by series expansion. Naturally, the function can be restored only with a certain accuracy.
IMHO the problem is solvable in theory.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question