/* analysis15.java */

public class analysis15
{

	public static int mypow (int b, int e) {
		if      (e == 0)	return 1;
		else if (e == 1)	return b;
		else				return b * mypow (b, e-1);
	}

	public static int iteriere (int n, int k, int count) {

		/* n hoch (1,2,4,8,...) hoch Dualkoeffizient von k */
		int thisStep = mypow (mypow (n, count), k%2);

		/* rekursiver Aufruf */
		if (k > 1) thisStep *= iteriere (n, k/2, count*2);

		return thisStep;

	}


	public static void main(String[] args)
	{

		System.out.println (iteriere (2, 5, 1));

		System.out.println (iteriere (3, 9, 1));

		System.out.println (iteriere (2, 24, 1));

	}
	
}
