summaryrefslogtreecommitdiff
path: root/p3/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'p3/main.c')
-rw-r--r--p3/main.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/p3/main.c b/p3/main.c
new file mode 100644
index 0000000..c72ba35
--- /dev/null
+++ b/p3/main.c
@@ -0,0 +1,30 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <math.h>
+
+#include "utils.h"
+
+int main(int argc, char **argv)
+{
+ // 90 = 2*3*3*5
+ // 17 = 17
+ // 147 = 3*7*7
+
+ long number = 600851475143;
+
+#include "primes_10000000.h"
+
+ list_t *factors = prime_factors_naive(prime_table, prime_table_size,
+ number);
+
+ list_t *curr = factors;
+ while (curr)
+ {
+ printf("%ld\n", *((long*)curr->value));
+ curr = curr->next;
+ }
+
+ list_free(factors, &list_free_long);
+
+ return 0;
+}