#include<bits/stdc++.h>
using namespace std;
#define N 1000000
int p[N+1];
vector<int>a;
void prime()
{
int i, j, l;
l = sqrt(N);
p[0] = p[1] = 1;
for(i=2;i<=l;i++)
{
if(p[i] == 0)
{
for(j=2;i*j<=N;j++)
p[i*j] = 1;
}
}
}
int main()
{
prime();
int n, m, i, j, a, x, y;
while(cin >> n)
{
if(n == 0)
break;
x = y = 0;
for(i=2;i<n;i++)
{
a = n - i;
if(p[i] == 0)
{
if(p[a] == 0)
{
if(i + a == n)
{
x = i;
y = a;
break;
}
}
}
}
cout << n << ":" << endl;
if(x == 0 && y == 0)
cout << "NO WAY!" << endl;
else
cout << x << "+" << y << endl;
}
return 0;
}
using namespace std;
#define N 1000000
int p[N+1];
vector<int>a;
void prime()
{
int i, j, l;
l = sqrt(N);
p[0] = p[1] = 1;
for(i=2;i<=l;i++)
{
if(p[i] == 0)
{
for(j=2;i*j<=N;j++)
p[i*j] = 1;
}
}
}
int main()
{
prime();
int n, m, i, j, a, x, y;
while(cin >> n)
{
if(n == 0)
break;
x = y = 0;
for(i=2;i<n;i++)
{
a = n - i;
if(p[i] == 0)
{
if(p[a] == 0)
{
if(i + a == n)
{
x = i;
y = a;
break;
}
}
}
}
cout << n << ":" << endl;
if(x == 0 && y == 0)
cout << "NO WAY!" << endl;
else
cout << x << "+" << y << endl;
}
return 0;
}
Comments
Post a Comment