import java.io.*; import java.util.*; import java.math.*; /** * Solution to GCDs * * @author vanb */ public class gcd_vanb { public Scanner sc; public PrintStream ps; /** * Greatest Common Divisor * * @param a A number * @param b Another number * @return The GCD of a and b */ public static int gcd( int a, int b ) { return b==0 ? a : gcd( b, a%b ); } /** We'll store all of the GCDs in an array */ public static int gcds[][] = new int[101][101]; /** * Driver. * @throws Exception */ public void doit() throws Exception { sc = new Scanner( System.in ); //new File( "gcd.in" ) ); ps = System.out; //new PrintStream( new FileOutputStream( "gcd.out" ) ); // Precompute all GCDs for( int i=1; i<=100; i++ ) for( int j=i; j<=100; j++ ) { gcds[i][j] = gcds[j][i] = gcd( i, j ); } int a[] = new int[100000]; for(;;) { int n = sc.nextInt(); if( n==0 ) break; for( int i=0; i