How to resolve the algorithm Fibonacci n-step number sequences step by step in the ERRE 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 ERRE 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 ERRE programming language
Source code in the erre programming language
PROGRAM FIBON
!
! for rosettacode.org
!
DIM F[20]
PROCEDURE FIB(TIPO$,F$)
FOR I%=0 TO 20 DO
F[I%]=0
END FOR
B=0
LOOP
Q=INSTR(F$,",")
B=B+1
IF Q=0 THEN
F[B]=VAL(F$)
EXIT
ELSE
F[B]=VAL(MID$(F$,1,Q-1))
F$=MID$(F$,Q+1)
END IF
END LOOP
PRINT(TIPO$;" =>";)
FOR I=B TO 14+B DO
IF I<>B THEN PRINT(",";) END IF
PRINT(F[I-B+1];)
FOR J=(I-B)+1 TO I DO
F[I+1]=F[I+1]+F[J]
END FOR
END FOR
PRINT
END PROCEDURE
BEGIN
PRINT(CHR$(12);) ! CLS
FIB("Fibonacci","1,1")
FIB("Tribonacci","1,1,2")
FIB("Tetranacci","1,1,2,4")
FIB("Lucas","2,1")
END PROGRAM
You may also check:How to resolve the algorithm Literals/String step by step in the Modula-3 programming language
You may also check:How to resolve the algorithm Wireworld step by step in the 11l programming language
You may also check:How to resolve the algorithm Take notes on the command line step by step in the Sidef programming language
You may also check:How to resolve the algorithm Bin given limits step by step in the EasyLang programming language
You may also check:How to resolve the algorithm Arithmetic numbers step by step in the PL/M programming language