public int countAsRec(int n){
    
        if(n < 7){
            return n;
        }
        int max = Integer.MIN_VALUE;
        int result = 0;
        for(int b=n-3; b > 0; b--){
            result = (n-b-1)*countAs(b);
            if(max < result){
                max = result;
            }
        }
        return max;
    }
http://www.geeksforgeeks.org/how-to-print-maximum-number-of-a-using-given-four-keys/
Test cases
Negative number
Number less than 7
Number greater than equal to 7
src/com/interview/dynamic/CountAs.java