Upload files to "ex1F_goldbachs_conjecture"

This commit is contained in:
Jakob Schratter 2025-10-22 15:41:37 +02:00
commit bdf01bd761
4 changed files with 173 additions and 0 deletions

View file

@ -0,0 +1,37 @@
#include "../utils/timing.h"
#include "goldbach.h"
#include <iostream>
#include <algorithm>
using namespace std;
int main(int argc, char **argv)
{
cout << "Check: 694 has "<< single_goldbach(694) << " decompositions." << endl << "----------------------------------------" << endl;
for(size_t n : {10000, 100000, 400000, 1000000, 2000000})
{
tic();
auto goldbach_vector = count_goldbach(n);
auto max_it = max_element(goldbach_vector.begin(), goldbach_vector.end());
size_t max_number = distance(goldbach_vector.begin(), max_it);
double time = toc();
cout << "The number " << max_number << " has " << *max_it << " decompositions. Duration: " << time << endl;
}
/*
The number 9240 has 329 decompositions. Duration: 0.00572876
The number 99330 has 2168 decompositions. Duration: 0.3342
The number 390390 has 7094 decompositions. Duration: 4.23734
The number 990990 has 15594 decompositions. Duration: 29.5817
The number 1981980 has 27988 decompositions. Duration: 135.985
*/
return 0;
}