language: Haskell (ghc-7.4.1) date: 327 days 14 hours ago link: visibility: public private user's deleted
```<!--/**
* GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
* (http://qbnz.com/highlighter/ and http://geshi.org/)
*/
.haskell .imp {font-weight: bold; color: red;}
.haskell .kw1 {color: #06c; font-weight: bold;}
.haskell .kw2 {color: #06c; font-weight: bold;}
.haskell .kw4 {color: #cccc00; font-weight: bold;}
.haskell .co1 {color: #5d478b; font-style: italic;}
.haskell .co2 {color: #339933; font-weight: bold;}
.haskell .co3 {color: #5d478b; font-style: italic;}
.haskell .coMULTI {color: #5d478b; font-style: italic;}
.haskell .es0 {background-color: #3cb371; font-weight: bold;}
.haskell .sy0 {color: #339933; font-weight: bold;}
.ln, .ln{ vertical-align: top; }
-->1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

line <- getLine

--is_prime function
is_prime :: Integer -> Bool
is_prime n = helper n 2
where
helper :: Integer -> Integer -> Bool
helper n i
| n < 2 * i = True
| mod n i > 0 = helper n (i+1)
| otherwise = False

main = do
dump 1 n
where
dump i x = do
putStrLn ( show (i) ++ " is a prime? " ++ show (is_prime i) )
if i >= x
then putStrLn ("")
else do
dump (i+1) x
```
• result: Success     time: 0.02s    memory: 3720 kB     returned value: 0

```100
```
```1 is a prime? True
2 is a prime? True
3 is a prime? True
4 is a prime? False
5 is a prime? True
6 is a prime? False
7 is a prime? True
8 is a prime? False
9 is a prime? False
10 is a prime? False
11 is a prime? True
12 is a prime? False
13 is a prime? True
14 is a prime? False
15 is a prime? False
16 is a prime? False
17 is a prime? True
18 is a prime? False
19 is a prime? True
20 is a prime? False
21 is a prime? False
22 is a prime? False
23 is a prime? True
24 is a prime? False
25 is a prime? False
26 is a prime? False
27 is a prime? False
28 is a prime? False
29 is a prime? True
30 is a prime? False
31 is a prime? True
32 is a prime? False
33 is a prime? False
34 is a prime? False
35 is a prime? False
36 is a prime? False
37 is a prime? True
38 is a prime? False
39 is a prime? False
40 is a prime? False
41 is a prime? True
42 is a prime? False
43 is a prime? True
44 is a prime? False
45 is a prime? False
46 is a prime? False
47 is a prime? True
48 is a prime? False
49 is a prime? False
50 is a prime? False
51 is a prime? False
52 is a prime? False
53 is a prime? True
54 is a prime? False
55 is a prime? False
56 is a prime? False
57 is a prime? False
58 is a prime? False
59 is a prime? True
60 is a prime? False
61 is a prime? True
62 is a prime? False
63 is a prime? False
64 is a prime? False
65 is a prime? False
66 is a prime? False
67 is a prime? True
68 is a prime? False
69 is a prime? False
70 is a prime? False
71 is a prime? True
72 is a prime? False
73 is a prime? True
74 is a prime? False
75 is a prime? False
76 is a prime? False
77 is a prime? False
78 is a prime? False
79 is a prime? True
80 is a prime? False
81 is a prime? False
82 is a prime? False
83 is a prime? True
84 is a prime? False
85 is a prime? False
86 is a prime? False
87 is a prime? False
88 is a prime? False
89 is a prime? True
90 is a prime? False
91 is a prime? False
92 is a prime? False
93 is a prime? False
94 is a prime? False
95 is a prime? False
96 is a prime? False
97 is a prime? True
98 is a prime? False
99 is a prime? False
100 is a prime? False

```