-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathid0077.c
More file actions
39 lines (29 loc) · 717 Bytes
/
id0077.c
File metadata and controls
39 lines (29 loc) · 717 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Licensed under the MIT License.
// Prime Summations
#include "../lib/euler.h"
#include "../lib/partition.h"
#include "../lib/sieve.h"
#define MAX_SEARCH 100
int main(void)
{
long long term = -1;
struct Sieve primes;
clock_t start = clock();
euler_ok(sieve(&primes, MAX_SEARCH));
long long* parts = primes.primes.items;
long long* partitions = restricted_partition_range(
MAX_SEARCH,
parts,
primes.primes.count);
euler_assert(partitions);
for (int n = 0; n < MAX_SEARCH; n++)
{
if (partitions[n] > 5000)
{
term = n;
break;
}
}
free(partitions);
return euler_submit(77, term, start);
}