URM program to compute n^m (n to the power of m)

For n≠0 and m≠0,

1          S(6)

2          S(7)

3          C(1,3)

4          C(1,4)

5          J(2,7,19)

6          J(4,6,14)

7          J(3,5,11)

8          S(1)

9          S(5)

10        J(1,1,7)

11        S(6)

12        Z(5)

13        J(1,1,6)

14        C(1,3)

15        S(7)

16        Z(6)

17        S(6)

18        J(1,1,5)

n m 0 0 0 0 0
n m n n 0 1 1
n+1 m n n 1 1 1
n+2 m n n 2 1 1
n+3 m n n 3 1 1
n+n=2n m n n n 1 1
2n m n n 0 2 1
2n+1 m n n 1 2 1
2n+2 m n n 2 2 1
2n+n=3n m n n n 2 1
3n m n n 0 3 1
n(n)=n2 m n n n n-1 1
n2 m n n 0 n 1
n2 m n2 n 0 1 2
n2+1 m n2 n 1 1 2
n2+2 m n2 n 2 1 2
n2+n2=2n2 m n2 n n2 1 2
2n2 m n2 n 0 2 2
n(n2)=n3 m n2 n n2 n 2
n3 m n2 n 0 n 2
n3 m n3 n 0 1 3
n(nm-1)=nm m nm-1 n nm-1 n m-1
nm m nm n 0 1 m

Example 1.

2 4 0 0 0 0 0
2 4 2 2 0 1 1
3 4 2 2 1 1 1
4 4 2 2 2 1 1
4 4 2 2 0 2 1
4 4 4 2 0 1 2
5 4 4 2 1 1 2
6 4 4 2 2 1 2
7 4 4 2 3 1 2
8 4 4 2 4 1 2
8 4 4 2 0 2 2
8 4 8 2 0 1 3
9 4 8 2 1 1 3
10 4 8 2 2 1 3
11 4 8 2 3 1 3
12 4 8 2 4 1 3
13 4 8 2 5 1 3
14 4 8 2 6 1 3
15 4 8 2 7 1 3
16 4 8 2 8 1 3
16 4 8 2 0 2 3
16 4 16 2 0 1 4

Example 2.

3 3 0 0 0 0 0
3 3 3 3 0 1 1
4 3 3 3 1 1 1
5 3 3 3 2 1 1
6 3 3 3 3 1 1
6 3 3 3 3 2 1
6 3 3 3 0 2 1
7 3 3 3 1 2 1
8 3 3 3 2 2 1
9 3 3 3 3 2 1
9 3 3 3 3 2 1
9 3 3 3 0 3 1
9 3 9 3 0 1 2
10 3 9 3 1 1 2
11 3 9 3 2 1 2
12 3 9 3 3 1 2
13 3 9 3 4 1 2
14 3 9 3 5 1 2
15 3 9 3 6 1 2
16 3 9 3 7 1 2
17 3 9 3 8 1 2
18 3 9 3 0 2 2
19 3 9 3 1 2 2
20 3 9 3 2 2 2
21 3 9 3 3 2 2
22 3 9 3 4 2 2
23 3 9 3 5 2 2
24 3 9 3 6 2 2
25 3 9 3 7 2 2
26 3 9 3 8 2 2
27 3 9 3 9 2 2
27 3 9 3 0 3 2
27 3 27 3 0 1 3

For any positive integers n and m,

1          J(1,3,3)

2          J(2,3,23)

3          J(2,3,22)

4          S(6)

5          S(7)

6          C(1,3)

7          C(1,4)

8          J(2,7,25)

9          J(4,6,17)

10        J(3,5,14)

11        S(1)

12        S(5)

13        J(1,1,10)

14        S(6)

15        Z(5)

16        J(1,1,9)

17        C(1,3)

18        S(7)

19        Z(6)

20        S(6)

21        J(1,1,8)

22        J(1,1,22)

23        Z(1)

24        S(1)

Note: if n=m=0, the answer is undetermined and the program never stops.

Advertisements
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: