primes.in 314 B

123456789101112131415161718192021
  1. /*
  2. Simple prime number generator
  3. */
  4. count = 1;
  5. n = 1;
  6. limit = 100;
  7. while (n < limit) {
  8. k=3;
  9. p=1;
  10. n=n+2;
  11. while ((k*k<=n) && (p)) {
  12. p=n/k*k!=n;
  13. k=k+2;
  14. }
  15. if (p) {
  16. print(n, " is prime\n");
  17. count = count + 1;
  18. }
  19. }
  20. print("Total primes found: ", count, "\n");