質數
bool prime[65541];
long long u[33300];
int main(int argc, char const* argv[])
{
prime[1] = true;
int m = 0;
for(long long int i = 2;i <= 65540;i++){
if(!prime[i]){
u[m++] = i;
for(long long int j = i*i;j <= 65540;j = j+i){
prime[j] = true;
}
}
}
int n;
while(scanf("%d",&n) && n != 0){
vector<int> seq;
int pp;
bool flag = 0;
if(n<0){
flag = 1;
n = -n;
pp = n;
}else{
pp = n;
}
for(int i = 0;u[i]*u[i]<= n;i++){
if( n%u[i] == 0){
//printf("i = %lld ,n = %d\n",i,n);
while(n%u[i] == 0){
n = n/u[i];
seq.push_back(u[i]);
}
}
}
if(n>1){
seq.push_back(n);
}
int l = seq.size();
if(flag){
printf("%d = -1 x",-pp);
}else{
printf("%d =",pp);
}
for(int i = 0;i<l;i = i+1 ){
if(!i){
printf(" %d",seq[i]);
}else{
printf(" x %d",seq[i]);
}
}
printf("\n");
}
return 0;
}