                    ABCD
                    CABD
                    ACDB
                    DACB
                    BCDA
                    ACBD
                    ADCB
                    CDAB
                    DABC
                    BCAD
                    CADB
                    CDBA
                    CBAD
                    ABDC
                    ADBC
                    BDCA
                    DCBA
                    BACD
                    BADC
                    BDAC
                    CBDA
                    DBCA
                    DCAB

Listed above are   all-but-one   of the permutations of the symbols   A,   B,   C,   and   D,   except   for one permutation that's   not   listed.



Task

Find that missing permutation.



Methods

 Obvious method: 
        enumerate all permutations of   A,  B,  C,  and  D,  
        and then look for the missing permutation. 

 alternate method:
        Hint:  if all permutations were shown above,  how many 
        times would  A  appear in each position?     
        What is the  parity  of this number?

 another alternate method:
        Hint:  if you add up the letter values of each column, 
        does a missing letter   A,  B,  C,  and  D   from each
        column cause the total value for each column to be unique?



Related task

   Permutations)


PROC Main()
  DEFINE PTR="CARD"
  DEFINE COUNT="23"
  PTR ARRAY perm(COUNT)
  CHAR ARRAY s,missing=[4 0 0 0 0]
  BYTE i,j
 
  perm(0)="ABCD"  perm(1)="CABD"
  perm(2)="ACDB"  perm(3)="DACB"
  perm(4)="BCDA"  perm(5)="ACBD"
  perm(6)="ADCB"  perm(7)="CDAB"
  perm(8)="DABC"  perm(9)="BCAD"
  perm(10)="CADB" perm(11)="CDBA"
  perm(12)="CBAD" perm(13)="ABDC"
  perm(14)="ADBC" perm(15)="BDCA"
  perm(16)="DCBA" perm(17)="BACD"
  perm(18)="BADC" perm(19)="BDAC"
  perm(20)="CBDA" perm(21)="DBCA"
  perm(22)="DCAB"
 
  FOR i=0 TO COUNT-1
  DO
    s=perm(i)
    FOR j=1 TO 4
    DO
      missing(j)==XOR s(j)
    OD
  OD
 
  Print(missing)
RETURN