September Morn Update
This commit is contained in:
parent
4e2d22a71d
commit
aac6731f2c
6856 changed files with 141342 additions and 21127 deletions
|
|
@ -1,14 +1,24 @@
|
|||
FUNCTION itFib (n)
|
||||
n1 = 0
|
||||
n2 = 1
|
||||
FOR k = 1 TO ABS(n)
|
||||
sum = n1 + n2
|
||||
n1 = n2
|
||||
n2 = sum
|
||||
NEXT k
|
||||
IF n < 0 THEN
|
||||
itFib = n1 * ((-1) ^ ((-n) + 1))
|
||||
ELSE
|
||||
itFib = n1
|
||||
END IF
|
||||
END FUNCTION
|
||||
# Basic-256 ver 1.1.4
|
||||
# iterative Fibonacci sequence
|
||||
# Matches sequence A000045 in the OEIS, https://oeis.org/A000045/list
|
||||
|
||||
# Return the Nth Fibonacci number
|
||||
|
||||
input "N = ",f
|
||||
limit = 500 # set upper limit - can be changed, removed
|
||||
f = int(f)
|
||||
if f > limit then f = limit
|
||||
a = 0 : b = 1 : c = 0 : n = 0 # initial values
|
||||
|
||||
|
||||
while n < f
|
||||
print n + chr(9) + c # chr(9) = tab
|
||||
a = b
|
||||
b = c
|
||||
c = a + b
|
||||
n += 1
|
||||
|
||||
end while
|
||||
|
||||
print " "
|
||||
print n + chr(9) + c
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue