a-conjecture-of-mine

An exercise on polyglossy: the same problem solved on multiple languages

commit ab68089e4f0a13dda9eeb8d37f9b70f2bee405b2
parent b033617f3443e322d7b21f0944c4183fb5651221
Author: Pablo Escobar Gaviria <gark.garcia@protonmail.com>
Date:   Tue, 21 Jan 2020 14:29:23 -0200

Cleaned the C implementation.

Diffstat:
MC/main.c | 4+---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/C/main.c b/C/main.c
@@ -80,9 +80,7 @@ int main(int argc, char *argv[])
         range thread_ranges[n_threads];
 
         // Create the sums cache
-        // Original (2 * max) causing seg faults in multi-threading
-        int sums_c = 3 * max;
-        sums_cache = malloc(sizeof(int) * sums_c);
+        sums_cache = malloc(sizeof(int) * (2 * max + 1));
         for (int i = 0; i <= sums_c; i++)
             sums_cache[i] = sum_digits(i);