import java.util.stream.DoubleStream; public class TestNumbers { public static void main(String[] args) { System.out.println(); Integer startLength = 11; double[] startData = new double[startLength]; for(int index = 0;index<startLength;index++){ startData[index] = (double) index; } for(int numberOfData = startLength;numberOfData>0;numberOfData--) { int n = 15; double[] data = new double[numberOfData]; for (int index = 0; index < numberOfData; index++) { data[index] = startData[index]; System.out.print(data[index] + " "); } double ruslanacci10; for (int k10 = 0; k10 < n; k10++) { ruslanacci10 = DoubleStream.of(data).sum(); System.arraycopy(data, 1, data, 0, data.length - 1); data[data.length - 1] = ruslanacci10; System.out.print(ruslanacci10 + " "); } System.out.println(); } } } work result:
the conclusion should be as it is now
0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 55.0 110.0 219.0 436.0 869.0 1734.0 3463.0 6920.0 13833.0 27658.0 55307.0 110604.0 221153.0 442196.0 884173.0 0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 45.0 90.0 179.0 356.0 709.0 1414.0 2823.0 5640.0 11273.0 22538.0 45067.0 90089.0 180088.0 359997.0 719638.0 0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 36.0 72.0 143.0 284.0 565.0 1126.0 2247.0 4488.0 8969.0 17930.0 35824.0 71576.0 143009.0 285734.0 570903.0 0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 28.0 56.0 111.0 220.0 437.0 870.0 1735.0 3464.0 6921.0 13814.0 27572.0 55033.0 109846.0 219255.0 437640.0 0.0 1.0 2.0 3.0 4.0 5.0 6.0 21.0 42.0 83.0 164.0 325.0 646.0 1287.0 2568.0 5115.0 10188.0 20293.0 40422.0 80519.0 160392.0 319497.0 0.0 1.0 2.0 3.0 4.0 5.0 15.0 30.0 59.0 116.0 229.0 454.0 903.0 1791.0 3552.0 7045.0 13974.0 27719.0 54984.0 109065.0 216339.0 0.0 1.0 2.0 3.0 4.0 10.0 20.0 39.0 76.0 149.0 294.0 578.0 1136.0 2233.0 4390.0 8631.0 16968.0 33358.0 65580.0 128927.0 0.0 1.0 2.0 3.0 6.0 12.0 23.0 44.0 85.0 164.0 316.0 609.0 1174.0 2263.0 4362.0 8408.0 16207.0 31240.0 60217.0 0.0 1.0 2.0 3.0 6.0 11.0 20.0 37.0 68.0 125.0 230.0 423.0 778.0 1431.0 2632.0 4841.0 8904.0 16377.0 0.0 1.0 1.0 2.0 3.0 5.0 8.0 13.0 21.0 34.0 55.0 89.0 144.0 233.0 377.0 610.0 987.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 the program works in descending order, the output starts from the last to the first. looks like a pyramid upside down from tip to bottom.
for an ascending view, output starts from zero to last
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 1.0 2.0 3.0 5.0 8.0 13.0 21.0 34.0 55.0 89.0 144.0 233.0 377.0 610.0 987.0 0.0 1.0 2.0 3.0 6.0 11.0 20.0 37.0 68.0 125.0 230.0 423.0 778.0 1431.0 2632.0 4841.0 8904.0 16377.0 0.0 1.0 2.0 3.0 6.0 12.0 23.0 44.0 85.0 164.0 316.0 609.0 1174.0 2263.0 4362.0 8408.0 16207.0 31240.0 60217.0 0.0 1.0 2.0 3.0 4.0 10.0 20.0 39.0 76.0 149.0 294.0 578.0 1136.0 2233.0 4390.0 8631.0 16968.0 33358.0 65580.0 128927.0 ....итд looks like a pyramid, is built from the tip to the bottom
how to bring this increasing conclusion to a conclusion similar to a decreasing one, in the shape of a pyramid upside down. it turns out he has to shift the line with zeros and write the next line in front of it, etc., from the tip to the bottom up.