diff options
author | tomsmeding <tom.smeding@gmail.com> | 2016-09-01 20:50:56 +0200 |
---|---|---|
committer | tomsmeding <tom.smeding@gmail.com> | 2016-09-01 20:50:56 +0200 |
commit | c4e6a3c7df4dafe5353c0739f27d15d4a5c6a143 (patch) | |
tree | ab4958c0f4743a7c5511c8ed701fb3b86703324f | |
parent | abeb43aa08efba521e3cb94cffd30f9c7dd48250 (diff) |
-rw-r--r-- | error.txt | 2 | ||||
-rw-r--r-- | primes.txt | 18 |
2 files changed, 19 insertions, 1 deletions
@@ -1,3 +1,3 @@ def main(){ - print(if 1 kaas; else swag); + print(if 1 kaas; else swag; + 1); } diff --git a/primes.txt b/primes.txt new file mode 100644 index 0000000..e693345 --- /dev/null +++ b/primes.txt @@ -0,0 +1,18 @@ +def checkprime(n){ + i = 2; + s = int(sqrt(n)); + while i <= s { + if n % i == 0 break; + i += 1; + } + return(i < s); +} + +def main(argc,argv){ + N = 100; + i = 2; + while i < N { + if checkprime(i) print(i); + i += 1; + } +} |