# How many secret codes can be made by assigning each letter of the alphabet a (unique) different letter?

The letter A can be assigned in 26 ways
The letter B can be assigned in 25 ways
.
.
.
The letter Z can be assigned in 1 ways
and in Euler constant form is $$e^{61.26170}$$

However, the answer in the text book is $$≈ (26!)^2/e$$

• Your $26!$ would not ensure all the code letters different to their original letters. $(26!)^2/e$ is even bigger so too large, though might have a typo. You might want to investigate derangements Dec 1 '21 at 9:36
• @coffeemath because $26!$ is squared in $(26!)^2/e$ Dec 1 '21 at 12:20

I think the book is (implicitly or explicitly) looking for codes where a letter is never mapped onto itself. In other words, it is asking for the number of derangements of 26 objects, which is approximately equal to $$\frac{26!}{e}$$.
$$n! \sum_{i=0}^n \frac{(-1)^i}{i!}$$
but for $$n \ge 1$$ you can just round $$\frac{n!}{e}$$ to the nearest integer.