#include<stdio.h> #include<iostream> #include<queue> #include<memory.h> #include <math.h> #include<time.h> #include <stdlib.h> using namespace std; const int MAX = 10000 * 100; const int MAXL = 10000 * 100; /** * 欧拉素数筛选法 */ int prime[MAX]; int np = 0; void primes() { memset(prime, -1, sizeof(prime)); for(int i = 2; i <= MAXL; i++) { if(prime[i] == -1) prime[np++] = i; for(int j = 0; j < np && prime[j] * i <= MAXL; j++) { if(prime[j] * i >= MAXL) { break; } prime[prime[j] * i] = 0; if(i % prime[j] == 0) break; } } } int main() { freopen("d:\1.txt", "r", stdin); primes(); long long l; bool first = true; while (cin >> l) { if(l == -1) return 0; for(int i = 0; i < np && prime[i] <= l; i++) { while (l % prime[i] == 0) { l = l / prime[i]; printf(" %d ", prime[i]); } } if(l != 1) { printf(" %lld ", l); } cout << endl; } return 0; }