- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproblem046.cpp
More file actions
Latest commit
34 lines (31 loc) · 623 Bytes
/
Copy pathproblem046.cpp
File metadata and controls
34 lines (31 loc) · 623 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
#include"lib/mathutils.h"
#include<cmath>
#include<iostream>
#include<vector>
intgoldbachsOtherConjecture()
{
for (int i = 9;; i += 2) {
if (isPrime(i)) {
continue;
}
bool wrong = true;
int sub = 2;
int inc = 6;
do {
if (isPrime(i - sub)) {
wrong = false;
break;
}
sub += inc;
inc += 4;
} while (sub < i);
if (wrong) {
return i;
}
}
}
intmain()
{
std::cout << "Answer: " << goldbachsOtherConjecture() << '\n';
return0;
}