Find the missing permutation: Difference between revisions

Content added Content deleted
(→‎{{header|Lua}}: shortened)
m (rearranged the placement of the permutation list, added bullet points for the three methods, added whitespace and highlighting to the task's preamble, added a ;Related task: (bold) header, changed verb tense.)
Line 1: Line 1:
{{task}}
{{task}}
These are all of the permutations of the symbols A, B, C and D,
except for one that's not listed.
Find that missing permutation.

(cf. [[Permutations]])

There is an obvious method :
enumerating all permutations of A, B, C, D, and looking for the missing one.


<pre>
There is an alternate method.
ABCD
Hint : if all permutations were here,
how many times would A appear in each position ?
What is the parity of this number ?

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

<pre>ABCD
CABD
CABD
ACDB
ACDB
Line 40: Line 24:
CBDA
CBDA
DBCA
DBCA
DCAB</pre>
DCAB
</pre>
Listed above are all of the permutations of the symbols &nbsp; '''A''', &nbsp; '''B''', &nbsp; '''C''', &nbsp; and &nbsp; '''D''', &nbsp; ''except'' &nbsp; for one permutation that's &nbsp; ''not'' &nbsp; 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:
* &nbsp; [[Permutations]])
<br><br>


=={{header|360 Assembly}}==
=={{header|360 Assembly}}==