How to resolve the algorithm Fibonacci n-step number sequences step by step in the XPL0 programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Fibonacci n-step number sequences step by step in the XPL0 programming language
Table of Contents
Problem Statement
These number series are an expansion of the ordinary Fibonacci sequence where: For small values of
n
{\displaystyle n}
, Greek numeric prefixes are sometimes used to individually name each series. Allied sequences can be generated where the initial values are changed:
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Fibonacci n-step number sequences step by step in the XPL0 programming language
Source code in the xpl0 programming language
include c:\cxpl\codes; \intrinsic 'code' declarations
proc Nacci(N, F0); \Generate Fibonacci N-step sequence
int N, \step size
F0; \array of first N values
int I, J;
def M = 10; \number of members in the sequence
int F(M); \Fibonacci sequence
[for I:= 0 to M-1 do \for all the members of the sequence...
[if I < N then F(I):= F0(I) \initialize sequence
else [F(I):= 0; \sum previous members to get member I
for J:= 1 to N do F(I):= F(I) + F(I-J);
];
IntOut(0, F(I)); ChOut(0, ^ );
];
CrLf(0);
];
[Text(0, " Fibonacci: "); Nacci(2, [1, 1]);
Text(0, "Tribonacci: "); Nacci(3, [1, 1, 2]);
Text(0, "Tetranacci: "); Nacci(4, [1, 1, 2, 4]);
Text(0, " Lucas: "); Nacci(2, [2, 1]);
]
You may also check:How to resolve the algorithm Holidays related to Easter step by step in the Perl programming language
You may also check:How to resolve the algorithm Text processing/Max licenses in use step by step in the Ada programming language
You may also check:How to resolve the algorithm 24 game step by step in the Ada programming language
You may also check:How to resolve the algorithm Fibonacci word/fractal step by step in the Wren programming language
You may also check:How to resolve the algorithm Program name step by step in the FreeBASIC programming language