refactor various files

This commit is contained in:
2025-04-28 16:59:44 +02:00
parent 5049c3ec13
commit 05c830c8e2
97 changed files with 513 additions and 2676 deletions

View File

@@ -0,0 +1,41 @@
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define N 998
int *find_next(int *a) {
for (int i = 0; i < N; i++) if (a[i] != 0) return a + i;
return NULL;
}
void kill_mults(int *a, int m) {
for (int i = 0; i < N; i++) if (a[i] % m == 0) a[i] = 0;
}
int main() {
// Setup all numbers
int n[N], *c;
int p[N], r = 0;
for (int i = 0; i < N; i++) {
n[i] = i + 2;
}
while (1){
int *c = find_next(n);
if ((c = find_next()) == NULL) break;
p[r++] = *c;
kill_mults(n, *c);
}
for (int i = 0; i < r; i++) {
printf("%d ", p[i]);
}
}