开发者

Algorithm to find the next number in a sequence of numbers?

I have the following sequence of numbers:

2 5 6 20 18 80 54 320 162 1280

I'm just not able to find the next following number or the algorithm to calculate it.

A开发者_Python百科ny hints?


The next number is 486.

The sequence is *3, *4.

Every odd index is multiplied by 4:

5 20 80 320 1280

Every even index is multiplied by 3:

2 6 18 54 162

Thus, 486 is the next number. :-)


The next is 486

Just wolframalpha

Mathematica output : {2, 5, 6, 20, 18, 80, 54, 320, 162, 1280, 486, 5120, 1458, 20480, 4374}

and here is recurrence relation it gives :

a(n+4) = 7*a(n+2)-12*a(n)


This problem is underdetermined. You could write a program to come up with some logical next number, but there's no guarantee that it would have anything to do with what the puzzle intended. For example, the computer could fit a tenth-order polynomial to the data, then use it to extrapolate to the next value. It could try to find some text corpus that would have these numbers appear in the name of the text, then return the first letter of that corpus. In other words, yes, the computer could come up with some number that fits, but because the puzzlemaker is looking for some specific answer there's no reason to think the computer would be right.

That said, the answer to the puzzle involves looking at the ratios of the odd-indexed terms and the ratio of the even-indexed terms. You'll spot a pattern. :-)


Here is the Java application that calculates that sequence:

/**
 * @author mpieciukiewicz
 */
public class Main {

    public static void main(String[] args) {
        new Main().run();
    }

    public void run() {
        for (int p=0; p<11; p++) {
            System.out.println(p+":"+number(p));
        }
    }

    private int calculate(int base, int multiplier, int power) {
        int result = base;
        for (int p=0; p<power; p++) {
            result = result * multiplier;
        }
        return result;
    }

    private int number(int index) {
       int half = index / 2;
       int number;
       if (index%2 == 0) {
           number = calculate(2, 3, half);
       } else {
           number = calculate(5, 4, half);
       }
       return number;
    }
}

The output of this program is:

0:2
1:5
2:6
3:20
4:18
5:80
6:54
7:320
8:162
9:1280
10:486

So the answer for your question is: 468.


Use Sloane's Integer Sequences. This is what professional mathematicians use as their starting point.


It's simple:

a1=2
a2=4
a3=a1*3
a4=a2*4
a5=a3*3
a6=a4*4

generally:

a(2k+1)=a(2k-1)*3
a(2k)=a(2k-2)*4


51,128 is the next number. there is no convergence in the differentiated rows so the triangle is reduce to 16,125.


486

separate the 2 sequences from that list of numbers 2 5 6 20 18 80 54 320 162 1280

2 6 18 54 162 5 20 80 320 1280

1st row is 3x 4th row is 4 x so next in sequence is 3x 162 and next number is 4x 1280

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜