1. 


/**
* FWP, Ausgewählte Probleme aus dem ACM Programming Contest, WS09
* Problem: 160 Factors and Factorials
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=3&page=show_problem&problem=96
*
* @author Christoph Hausmann
* @version 0.1, 10/15/2009
*
* Method : Ad-Hoc
* Status : Accepted
* Runtime: 0.076
*/

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;


public class FactorsAndFactorials_160 {

private static int[] primes = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97};

public static void main(String... args) throws IOException {

final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

final StringBuffer sb = new StringBuffer();

while(true) {
final String curLine = br.readLine();

if(curLine == null)
break;

final int num = Integer.parseInt(curLine);

if(num == 0)
break;

final int[] foundPrimes = new int[primes.length];
Arrays.fill(foundPrimes, 0);

for(int curNum = num; curNum >= 2; curNum--) {
if(isPrime(curNum)) {
foundPrimes[indexOfNum(primes, curNum)]++;
} else {
int tempNum = curNum;

while(tempNum > 1) {
for(int i = 0; i < primes.length; i++) {
if(tempNum%primes[i] == 0) {
foundPrimes[i]++;
tempNum = tempNum/primes[i];
break;
}

}
}
}
}

if(num < 100)
sb.append(" ");
if(num < 10)
sb.append(" ");

sb.append(num);
sb.append("! =");

if(num == 1) {
sb.append(" 0");
}
else {
int countNums = 0;

for(int curPrimes : foundPrimes) {
if(curPrimes != 0) {
countNums++;

if(countNums == 16) {
countNums = 0;
sb.append("\n ");
}

if(curPrimes < 100)
sb.append(" ");
if(curPrimes < 10)
sb.append(" ");
sb.append(curPrimes);
}
}
}

sb.append("\n");
}

System.out.print(sb.toString());
}

private static boolean isPrime(int num) {
for(int i = 0; i < primes.length; i++) {
if(primes[i] == num)
return true;
}

return false;
}

private static int indexOfNum(int[] nums, int num) {
for(int i = 0; i < nums.length; i++)
if(nums[i] == num)
return i;

return -1;
}
}