home *** CD-ROM | disk | FTP | other *** search
- *REM This batch file is Freeware, free to use and redistribute unmodified *
- *REM Jouni Miettunen * jon@stekt.oulu.fi * Oulu * Finland * Europe * 1992 *
-
- REM This calculates the first 76 Fibonacci numbers F(n) = F(n-1) + F(n-2)
- REM Timestamp 15-Nov-1992
-
- break on^setlocal^unalias *^unset *
- set a=0^set b=1
-
- :loop
- set c=%b^set b=%a^set a=%@eval[%b+%c]^set index=%@eval[%index+1]
-
- REM just trying to create a decent output
- screen %_row 0 Fibonacci(
- screen %_row %@eval[12-%@len[%index]] %index):
- screen %_row %@eval[36-%@len[%a]-%@int[%@eval[%@len[%a]/3]]]]
- set plaza=%@eval[%@len[%a]%%3]
- echos %@substr[%a,,%plaza]
- for %q in (0 3 6 9 12) echos ` `%@substr[%a,%@eval[%plaza+%q],3]
- echo.
-
- REM Can't calculate beyond 76th Fibonacci number, see FIBOS255.BTM for more
- if %index lt 76 goto loop
-
- :end
- break off^quit
-