24 if (numbers.size() == 2)
25 return numbers[0] * numbers[1] - numbers[0] - numbers[1];
27 set<mpz_class> representable;
28 representable.insert(0);
29 mpz_class minNumber = *min_element(numbers.begin(), numbers.end());
31 mpz_class maximumNotRepresentable = 0;
32 int representableRun = 0;
35 while (representableRun < minNumber) {
36 bool isNumberRepresentable =
false;
38 for (
size_t i = 0; i < numbers.size(); ++i) {
39 if (representable.find(number - numbers[i]) !=
40 representable.end()) {
41 isNumberRepresentable =
true;
46 if (isNumberRepresentable) {
47 representable.insert(number);
50 maximumNotRepresentable = number;
57 return maximumNotRepresentable;
mpz_class dynamicFrobeniusAlgorithm(const vector< mpz_class > &numbers)