#include "goldbach.h"
#include <algorithm>
#include <iostream>
#include <omp.h>
using namespace std;


int main()
{
    cout << "Check: 694 has "<< single_goldbach(694) << " decompositions." << endl << "----------------------------------------" << endl;

    for(size_t n : {10000, 100000, 400000, 1000000, 2000000})
    {
        double t_start = omp_get_wtime();

        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 t_end = omp_get_wtime() - t_start;

        cout << "The number " <<  max_number << " has " << *max_it << " decompositions. Duration: " << t_end << endl;
    }

    /*
    ###### WITHOUT PARALLELIZATION ######
    The number 9240 has 329 decompositions. Duration: 0.00307696
    The number 99330 has 2168 decompositions. Duration: 0.189839
    The number 390390 has 7094 decompositions. Duration: 1.3042
    The number 990990 has 15594 decompositions. Duration: 5.45034
    The number 1981980 has 27988 decompositions. Duration: 47.1807


    ###### WITH PARALLELIZATION ######
    The number 9240 has 329 decompositions. Duration: 0.000734854
    The number 99330 has 2168 decompositions. Duration: 0.0251322
    The number 390390 has 7094 decompositions. Duration: 0.487375
    The number 990990 has 15594 decompositions. Duration: 6.16972
    The number 1981980 has 27988 decompositions. Duration: 31.5699
    */


    return 0;
}