[Tutor] A small math puzzle [recreational Python]

Lloyd Hugh Allen lha2@columbia.edu
Sat, 05 Jan 2002 08:32:15 -0500


Danny Yoo wrote:
> However, here's an example that is a rearrangement but doesn't work
> because it has a fixed letter:
> 
>     'TRESAE'
>      ^
> 
> In this example, the 'T' makes this rearrangement inacceptable, since
> 'TERESA' itself begins with a 'T' too.
> 
> The puzzle is to write a program that counts all the possible
> rearrangements without fixed letters.
> 
> Have fun!

Is it necessary to actually construct the list of rearrangements, or do
you just want a function that will compute how many rearrangements
exist?