I have the following sequence of numbers:
2 5 6 20 18 80 54 320 162 1280
I just can't find the next next number or algorithm to calculate it.
Any clues?
The next number 486.
486
The sequence is * 3, * 4.
Each odd index is multiplied by 4:
5 20 80 320 1280
Each even index is multiplied by 3:
2 6 18 54 162
So the 486following number. :-)
Next 486
Just wolframalpha
Mathematica Output: {2, 5, 6, 20, 18, 80, 54, 320, 162, 1280, 486, 5120, 1458, 20480, 4374}
{2, 5, 6, 20, 18, 80, 54, 320, 162, 1280, 486, 5120, 1458, 20480, 4374}
and here is the recurrence relation that it gives:
a(n+4) = 7*a(n+2)-12*a(n)
. , , , - , . , , . - , , . , , - , , - , , .
, . .: -)
Java, :
/** * @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; } }
:
0:2 1:5 2:6 3:20 4:18 5:80 6:54 7:320 8:162 9:1280 10:486
, : 468.
Sloane Integer Sequences. , .
a1=2 a2=4 a3=a1*3 a4=a2*4 a5=a3*3 a6=a4*4
a(2k+1)=a(2k-1)*3 a(2k)=a(2k-2)*4
51, 128 - . , 16,125.
2 2 5 6 20 18 80 54 320 162 1280
2 6 18 54 162 5 20 80 320 1280
1- 3x 4- - 4 x 3x 162, - 4x 1280
Source: https://habr.com/ru/post/1786102/More articles:Using Linq in .NET Handlers - linqjava.util.regex - javaWhat is the vulnerability of having Jsessionid only on first request - securityImagecreatefrompng error - how to detect and process? - phpReturn one row in INNER JOIN - sqlTool for measuring html rendering time - htmlMVC Controller Generic injection с AutoFac - genericsCan I execute a custom complex group in a Django QuerySet? - pythonWhat is the definition of "component" in JSF - javaHow to write an automatic search query in python? - jqueryAll Articles