2022-03-25 13:29:45 -04:00
|
|
|
( Fibonacci:
|
|
|
|
A series of numbers where the next number
|
|
|
|
is made of the two numbers before it )
|
2022-02-23 18:23:38 -05:00
|
|
|
|
2023-06-02 00:53:28 -04:00
|
|
|
|100
|
2022-02-23 18:23:38 -05:00
|
|
|
|
2023-06-02 00:53:28 -04:00
|
|
|
#0019 #0000
|
|
|
|
&l
|
|
|
|
DUP2 pdec #2018 DEO
|
|
|
|
DUP2 fib pdec #0a18 DEO
|
|
|
|
INC2 GTH2k ?&l
|
|
|
|
POP2 POP2
|
2022-11-10 12:08:21 -05:00
|
|
|
#010f DEO
|
2022-02-23 18:23:38 -05:00
|
|
|
|
|
|
|
BRK
|
|
|
|
|
2023-06-02 00:53:28 -04:00
|
|
|
@fib ( num -- numfib* )
|
|
|
|
#0001 GTH2k ?&ok
|
|
|
|
POP2 JMP2r &ok
|
|
|
|
SUB2k fib STH2 INC2
|
|
|
|
SUB2 fib STH2r
|
|
|
|
ADD2
|
|
|
|
JMP2r
|
|
|
|
|
|
|
|
@pdec ( short* -- )
|
2022-02-23 18:23:38 -05:00
|
|
|
|
2023-06-02 00:53:28 -04:00
|
|
|
#2710 LIT2r 00fb
|
|
|
|
&w
|
|
|
|
DIV2k #000a DIV2k MUL2 SUB2 SWPr
|
|
|
|
EQUk OVR STHkr EQU AND ?&skip
|
|
|
|
DUP LIT "0 ADD #19 DEO INCr
|
|
|
|
&skip
|
|
|
|
POP2 #000a DIV2
|
|
|
|
SWPr INCr STHkr ?&w
|
|
|
|
POP2r POP2 POP2
|
2022-02-23 18:23:38 -05:00
|
|
|
|
|
|
|
JMP2r
|
2023-06-02 00:53:28 -04:00
|
|
|
|