J
J
Jony13372016-09-19 20:52:57
Java
Jony1337, 2016-09-19 20:52:57

How to create an algorithm for solving such a problem?

Hello everyone
How to create an algorithm for solving such a problem:
Let's say we have numbers 1,9,25,49,81
formula xn = (2n-1)^2
That is, if we put the number 1 instead of n, then we will also have results 1 and if we put 2 instead of n then the results will be 9 .
How to make a mini algorithm that, with the water of numbers, would display a formula, let's say we have 2,4,8,16,32 and it shows me that xn =
I've been racking my brain for the second day.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
I
Igor Aule, 2016-09-19
@gladyshev18

It seems to me that the author meant the usual interpolation

D
Daemon23RUS, 2016-09-20
@Daemon23RUS

Which Lagrange? What interpolation? This is a school curriculum. But as colleagues correctly noted, here you need to use a neural network. Unfortunately they didn't say which one. I will inform you: you need to use the network in your head, or the head of a neighbor.
PS bonus solution "... number 1 ; -2 ; 3 ; -4 ; 5 ..." - formula: (-n)*(-1)^n

G
GavriKos, 2016-09-19
@GavriKos

They did something similar to the labe. We used genetic algorithms. But - right for any set you will not get the exact formula. Especially depends on the allowed mathematical operators.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question