OSDN Git Service
(root)
/
fast-forth
/
master.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
V309 Modified APPEND" in the long run, clusters can become non-contiguous
[fast-forth/master.git]
/
MSP430-FORTH
/
lib
/
PRIMES.4th
1
\ PRIMES.4th
2
3
PWR_STATE
4
: PRIMES
5
\ 2 SWAP 2 . 3 . 5
6
2 SWAP 2 4 U.R 3 4 U.R 5
7
DO DUP DUP * I
8
< IF 1+ THEN
9
1 OVER 1+ 3
10
DO J I MOD
11
0= IF 1- LEAVE THEN
12
2 +LOOP
13
\ IF I . THEN
14
IF I 4 U.R THEN
15
2 +LOOP
16
DROP ;
17
18
\ 1000 PRIMES : display prime numbers up to 1000
19
\ FAST FORTH for MSP430FR5969 @16MHz + TERATERM @921600Bds : 0.13 s
20
21
: TEST \ 1.3s @ 16 MHz
22
10 0 DO
23
CR
24
1000 PRIMES
25
LOOP ;
26
27
TEST