Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,18 @@
|
|||
PRINT "First 10 terms of Q = " ;
|
||||
FOR i% = 1 TO 10 : PRINT ;FNq(i%, c%) " "; : NEXT : PRINT
|
||||
PRINT "1000th term = " ; FNq(1000, c%)
|
||||
PRINT "100000th term = " ; FNq(100000, c%)
|
||||
PRINT "Term is less than preceding term " ; c% " times"
|
||||
END
|
||||
|
||||
DEF FNq(n%, RETURN c%)
|
||||
LOCAL i%,q%()
|
||||
IF n% < 3 THEN = 1 ELSE IF n% = 3 THEN = 2
|
||||
DIM q%(n%)
|
||||
q%(1) = 1 : q%(2) = 1 : q%(3) = 2
|
||||
c% = 0
|
||||
FOR i% = 3 TO n%
|
||||
q%(i%) = q%(i% - q%(i%-1)) + q%(i% - q%(i%-2))
|
||||
IF q%(i%) < q%(i%-1) THEN c% += 1
|
||||
NEXT
|
||||
= q%(n%)
|
||||
Loading…
Add table
Add a link
Reference in a new issue