Environment for creative processing of text
and numerical data | |
Listing prime numbers using the macro language of Survo
Beginning status (before activations):
1 *
2 *This is a Survo macro program (sucro), which lists prime numbers
3 *
4 *TUTSAVE PRIMES / Saving the program
5 / This sucro lists prime numbers.
6 / def Wnumber=W1 Wdivisor=W2 Wremainder=W3 Wsquare=W4
7 *{tempo 1}{R}
8 *{message} Stop by pressing the key '.' (full stop)@
9 *SCRATCH {act}{home}2 3{Wnumber=1}
10 + A: {Wnumber=Wnumber+2}{Wdivisor=1}
11 + B: {Wdivisor=Wdivisor+2}{Wremainder=Wnumber%Wdivisor}
12 - if Wremainder = 0 then goto A
13 *{Wsquare=Wdivisor*Wdivisor}
14 - if Wsquare < Wnumber then goto B
15 * {write Wnumber}{goto A}{end}
16 *
17 */PRIMES / starting the program
18 *
Ending status (after activations):
1 *
2 *This is a Survo macro program (sucro), which lists prime numbers
3 *
4 *TUTSAVE PRIMES / Saving the program
5 / This sucro lists prime numbers.
6 / def Wnumber=W1 Wdivisor=W2 Wremainder=W3 Wsquare=W4
7 *{tempo 1}{R}
8 *{message} Stop by pressing the key '.' (full stop)@
9 *SCRATCH {act}{home}2 3{Wnumber=1}
10 + A: {Wnumber=Wnumber+2}{Wdivisor=1}
11 + B: {Wdivisor=Wdivisor+2}{Wremainder=Wnumber%Wdivisor}
12 - if Wremainder = 0 then goto A
13 *{Wsquare=Wdivisor*Wdivisor}
14 - if Wsquare < Wnumber then goto B
15 * {write Wnumber}{goto A}{end}
16 *
17 */PRIMES / starting the program
18 *2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97
19 *101 103 107 109 113 127 131 137 139 149 151 157 163 167 173 179 181 191
20 *193 197 199 211 223 227 229 233 239 241 251 257 263 269 271 277 281 283
21 *293 307 311 313 317 331 337 347 349 353 359 367 373 379 383 389 397 401
22 *409 419 421 431 433 439 443 449 457 461 463 467 479 487 491 499 503 509
23 *521 523 541 547 557 563 569 571 577 587 593 599 601 607 613 617 619 631
24 *641 643 647 653 659 661
25 *
26 * (The program has been stopped by pressing the key .)
27 *
Previous
| Next