summaryrefslogtreecommitdiff
path: root/src/main.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.zig')
-rw-r--r--src/main.zig16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/main.zig b/src/main.zig
index 3a194fd..8966363 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -136,21 +136,19 @@ fn p6() void {
}
fn p7() void {
- const size: usize = 10_002;
- var primes: [size]usize = undefined;
-
var i: usize = 1;
var j: usize = 0;
- while (j < size) : (i += 1) {
+ while (j != 10_002) : (i += 1) {
if (is_prime(i)) {
- primes[j] = i;
j += 1;
}
}
- print("{}\n", .{primes[size - 1]});
+ print("{}\n", .{i - 1});
}
-fn p8() void {}
+fn p8() void {
+ print("{}\n", .{1});
+}
pub fn main() !void {
//p1();
@@ -159,6 +157,6 @@ pub fn main() !void {
//_ = try p4();
//p5();
//p6();
- //p7();
- p8();
+ p7();
+ //p8();
}