The "multiplication (*)" in the group is simply performing them after one another. Take 6 coloured balls. Permute the first and third one. Now permute the third and fifth one (note: by third one I mean the one in the third position, not the third ball which is not in the first position). You have just composed the permutations (13) and (35). In effect, you have moved the first one to the fifth, the fifth one to the third and the third one to the first, so in cycle notation: (35) * (13) = (153). (where the composition o is to be read as: "after"). Then as in any group, a power is simply composing the permutation with itself, e.g. (13)**2 = (13) * (13) = 1 (153)**2 = (153)(153) = (135) and working out the order is simply composing until you get the identity, e.g. (153)**3 = (135)(153) = 1 To print out either do multiplication and take power, they all equal to identity number. What I can do now is. first ball integer x(6) integer i; do i = 1,6,1 x(i) =i end do finish permutation, if x(i) is 1,2,3,4,5,6 then identity=1 integer flag flag = 1 ！first ball do i = 1,6,1 if ( x(i) .NE. i ) then flag = 0 end if end do if flag .EQ. 1 identity=1 But I don't know how to create Do Loops, IF block, and Subroutine to To print out either do multiplication and take power, they all equal to identity number. Can any one help me please.