import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
    
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int K = sc.nextInt();
        
        int gcd = GCD(A, B);
        
        int div = 2;
        int cnt = 1;
        while( cnt < K ){
            if( gcd % div == 0 ){
                cnt++;
            }
            div++;
        }
        
        System.out.println( gcd/(div-1) );

    }
    
    static int GCD(int x, int y){
        if( y == 0) return x;
        return GCD(y, x % y);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
    
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int K = sc.nextInt();
        
        int gcd = GCD(A, B);
        
        int div = 2;
        int cnt = 1;
        while( cnt < K ){
            if( gcd % div == 0 ){
                cnt++;
            }
            div++;
        }
        
        System.out.println( gcd/(div-1) );

    }
    
    static int GCD(int x, int y){
        if( y == 0) return x;
        return GCD(y, x % y);
    }
} Main public static void main(String[] args) throws Exception {
    
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int K = sc.nextInt();
        
        int gcd = GCD(A, B);
        
        int div = 2;
        int cnt = 1;
        while( cnt < K ){
            if( gcd % div == 0 ){
                cnt++;
            }
            div++;
        }
        
        System.out.println( gcd/(div-1) );

    } main {
    
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int K = sc.nextInt();
        
        int gcd = GCD(A, B);
        
        int div = 2;
        int cnt = 1;
        while( cnt < K ){
            if( gcd % div == 0 ){
                cnt++;
            }
            div++;
        }
        
        System.out.println( gcd/(div-1) );

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int A = sc.nextInt(); A sc.nextInt() sc.nextInt sc int B = sc.nextInt(); B sc.nextInt() sc.nextInt sc int K = sc.nextInt(); K sc.nextInt() sc.nextInt sc int gcd = GCD(A, B); gcd GCD(A, B) GCD A B int div = 2; div 2 int cnt = 1; cnt 1 while( cnt < K ){
            if( gcd % div == 0 ){
                cnt++;
            }
            div++;
        } cnt < K cnt K {
            if( gcd % div == 0 ){
                cnt++;
            }
            div++;
        } if( gcd % div == 0 ){
                cnt++;
            } gcd % div == 0 gcd % div gcd div 0 {
                cnt++;
            } cnt++ cnt div++ div System.out.println( gcd/(div-1) ) System.out.println System.out System System.out gcd/(div-1) gcd (div-1) div 1 String[] args args static int GCD(int x, int y){
        if( y == 0) return x;
        return GCD(y, x % y);
    } GCD {
        if( y == 0) return x;
        return GCD(y, x % y);
    } if( y == 0) return x; y == 0 y 0 return x; x return GCD(y, x % y); GCD(y, x % y) GCD y x % y x y int x x int y y public class Main {
    public static void main(String[] args) throws Exception {
    
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int K = sc.nextInt();
        
        int gcd = GCD(A, B);
        
        int div = 2;
        int cnt = 1;
        while( cnt < K ){
            if( gcd % div == 0 ){
                cnt++;
            }
            div++;
        }
        
        System.out.println( gcd/(div-1) );

    }
    
    static int GCD(int x, int y){
        if( y == 0) return x;
        return GCD(y, x % y);
    }
} public class Main {
    public static void main(String[] args) throws Exception {
    
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int K = sc.nextInt();
        
        int gcd = GCD(A, B);
        
        int div = 2;
        int cnt = 1;
        while( cnt < K ){
            if( gcd % div == 0 ){
                cnt++;
            }
            div++;
        }
        
        System.out.println( gcd/(div-1) );

    }
    
    static int GCD(int x, int y){
        if( y == 0) return x;
        return GCD(y, x % y);
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
    
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int K = sc.nextInt();
        
        int gcd = GCD(A, B);
        
        int div = 2;
        int cnt = 1;
        while( cnt < K ){
            if( gcd % div == 0 ){
                cnt++;
            }
            div++;
        }
        
        System.out.println( gcd/(div-1) );

    }
    
    static int GCD(int x, int y){
        if( y == 0) return x;
        return GCD(y, x % y);
    }
}
