repo.or.cz
/
valgrind.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
FreeBSD regtest: add missing helgrind expecteds
[valgrind.git]
/
auxprogs
/
primes.c
blob
bf2fb82d9b1497bbf53cc7f88c7de5d086f2512c
1
2
#include <stdio.h>
3
#include <math.h>
4
5
int
isprime
(
int
n
)
6
{
7
int
m
;
8
int
sqrt_n
=
sqrt
(
n
);
9
for
(
m
=
2
;
m
<=
sqrt_n
+
1
;
m
++)
// +1 in case of obscure rounding error
10
if
((
n
%
m
) ==
0
)
return
0
;
11
return
1
;
12
}
13
14
int
main
(
int
argc
,
char
**
argv
)
15
{
16
int
i
;
17
for
(
i
=
79000
;
i
<
81000
;
i
++)
18
if
(
isprime
(
i
)) {
printf
(
"%d "
,
i
);
fflush
(
stdout
); }
19
return
0
;
20
}