Discrete Mathematics Level pending

There are $$n$$ baskets of fruits in a line, with $$n$$ fruits also present. Each basket is designated to a certain fruit, and that fruit is placed inside it basket. How many ways can the fruits be rearrange such that no fruit is in its designated basket? Let $$a_1$$ denote the answer if $$n = 1$$, $$a_2$$ denote the answer if $$n = 2$$, and so on ($$a_n$$ is the answer with $$n$$ fruits and baskets). If I know the values of $$n-1, a_{n-1}$$, and $$a_{n-2}$$, how many calculations must I make to find $$a_n$$.

Details and Assumptions

• There is only one of each type of fruit.
• Each basket must contain exactly one fruit.
×