1. 
/**
* FWP: Ausgewaehlte Probleme aus dem ACM (SS10)
*
* Method: Math: Primes
* Problem: 160 - FactorsAndFactorials
* Accepted: 0.004
* @author Evgeni Pavlidis
*
*/
import java.io.*;
import java.util.*;

class Main {


public static final int MAX = 100;
public static int[] prime = {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 final int[][] cache = new int[MAX+1][25];


private static void findPrimes(int f)
{
int power, divisor, p;

for(int i = 0; i < prime.length; i++)
{
p = prime[i];
power = 0;
divisor = 1;

do
{
divisor *= p;
power += f / divisor;
}
while( f / (divisor*p) > 0);
cache[f][i] = power;
}

}

public static void main(String...args) throws Exception
{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
StringBuffer output = new StringBuffer();
String input;
int n, c;

for(int i=2; i <= MAX; i++)
findPrimes(i);


while( (input = reader.readLine()) != null )
{
n = Integer.parseInt(input);
if(n == 0)
break;

c = 0;

output.append(String.format("%3d! =",n));
for(int i=0; i < prime.length; i++)
if(cache[n][i] > 0)
{
c++;
if(c > 15)
{
output.append("\n ");
c = 0;
}

output.append(String.format(" %2d",cache[n][i]));

}
output.append("\n");
}
System.out.print(output.toString());

}
}