home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 3 / PDCD_3.iso / pocketbk / developmen / forth129 / APP / FORTH / Demo.sav (.txt) next >
Encoding:
Psion Database  |  1995-04-17  |  872 b   |  17 lines

  1. OPLDatabaseFile
  2. variable count
  3. variable primes 200 allot
  4. : init 1 count ! 2 primes ! ;2
  5. 1: show primes count @ 0 do dup @ . 2+ loop drop ;
  6. : check 10000 3 do i primes count @ 0 do over over @ mod 0= if drop drop 0 leave else 2+ then loop dup 0= if drop else count @ 1+ dup 200 = if leave then count ! ! then loop ;5
  7. 4: go ." finding 200 primes ..." cr init check show ;D
  8. C: bars cls 0 10 0 do 0 over at 48 + 160 over box loop drop 7 0 at ;Y
  9. X: rnd cls 100 0 do rand 400 0 d/ 2 roll drop rand 136 0 d/ 2 roll drop box loop 7 0 at ;
  10. : 2dup over over ;3
  11. 2: d0= 0= if 0= if 1 else 0 then else drop 0 then ;
  12. : 2drop drop drop ;
  13. : d1- 0 1 d- ;:
  14. 9: fact 2dup d0= if 2drop 0 1 else 2dup d1- fact d* then ;
  15. : n! 0 swap fact d. ;}0
  16. ROM::BJ.WDR
  17.