package paperPart;

/**
 * Simple recursion.
 * 
 * @author Curt Clifton
 */
public class Recur {
	public static void main(String[] args) {
		for (int n = 0; n < 40; n++) {
			System.out.printf("G(%2d) = %2d%n", n, g(n));
		}

		int answer = g(4);
		System.out.println(answer);
	}

	private static int g(int n) {
		System.out.printf("    Entering g(%d)%n", n);
		if (n == 0)
			return 1;
		int p = g(n - 1);
		return n - p;
	}

}
