1

We have to prepare pizza with 8 slices, and have 10 toppings to put on the pizza. We can put only one topping on each slice but can use the same topping on zero or more slices. In how many unique ways can we prepare the slices so that the same topping is not used in adjacent slices?

I have seen this question with 4 slices and 5 toppings but that seems to be visualizable. But with 8 slices, I am confused on the part when we select 7 or less toppings with identical objects in circular permutation. Please help on how should be problem be approached and solved.

N. F. Taussig
  • 79,074

3 Answers3

1

A type of pizza is a string of $8$ digits where each neighboring pair is different, including the first and the last. We regard two strings as equivalent if one is a cyclic shift of the other.

To take care of having different first and last digits, we define two sequences. $A(n)$ is the number of $n$ digit strings with the first and last digits the same. $B(n)$ is the number of $n$ digit strings with the first and last digits different. Before considering the circular shifts we want $B(8)$.

The recurrence is $A(n)=B(n-1)$ because any string that doesn't have matching first and last digits can be extended in $1$ way to a string that does. $B(n)=9A(n-1)+8B(n-1)$ because we can extend a string with matching first and last in $9$ ways by choosing any other digit but if the first and last do not match and we need them still not to match we only have $8$ choices. Our starting cases are $A(1)=10,B(1)=0$. A quick spreadsheet gives $B(8)=43\ 046\ 730.$

Most pizzas can be rotated eight different ways, but there are $B(2)=90$ that alternate two toppings. They can only be rotated two ways, so there are $45$ pizzas that have only two different toppings. There are $B(4)=6570$ that have two runs of four toppings. We have already counted $90$ of these. The other $6570-90$ can be rotated four ways. The final count is then $\frac {90}2+\frac {6570-90}4+\frac {43\ 046\ 730-6570}8=5\ 381\ 685$ different pizzas

Ross Millikan
  • 383,099
  • cant this be solved in a simple way, case by case (first take 8 toppings and circularly permute them, then take 7, permute and like that till 2 toppings?) I am confused on how to circularly permute when we have identical objects to two types. Sorry I am a bit novice in this, not able to properly understand your solution, although I will try harder..Thanks for the solution. – Madhura Pande Jun 04 '17 at 18:22
  • For two rotations the only allowable pizzas are ABABABAB, which has $45$ possibilities. For four you need ABCDABCD or ABACABAC – Ross Millikan Jun 04 '17 at 18:38
0

Lets Start from any slice. the no. of choice of toppings for this slice is 10. The choice of toppings for slices adjacent to this slice on both sides is 9, since we cannot use same topping on adjacent slices. Similarly for next 2 slices on both sides. this continues till we reach the last slice. For this slice the choice of toppings depend on the topping on the adjacent slices. There are 2 cases: The topping on these 2 slices can either be same or be different. We compute the number of combinations in both these cases and sum them up. So for case 1 (Same topping): No. of combinations= 10*9*9*9*9*9*1*9 for case 2 (Different topping): No. of combinations=10*9*9*9*9*9*8*8

So Total combinations: 10*9*9*9*9*(9*1*9 + 9*8*8)=43105770

  • 2
    Welcome to MSE. Please use MathJax. – José Carlos Santos May 17 '18 at 09:32
  • You didn’t take into account that if topping $n-2$ is the same as topping $1$, then all $9$ choices for topping $n-1$ leave $8$ choices for topping $n$. Since this happens in roughly $\frac1{10}$ of the cases, the resulting estimate is

    $$ 10\cdot9\cdot9\cdot9\cdot9\cdot9\left(\frac9{10}(1\cdot9+8\cdot8)+\frac1{10}(9\cdot8)\right)=43046721;. $$

    The remaining difference of $9$ from Ross Millikan’s correct count is due to the fact that the proportion isn’t exactly $\frac1{10}$ (see also the question that I linked to in my answer).

    – joriki Feb 27 '24 at 00:04
0

Since there are two conflicting answers and neither had been upvoted for a while, let’s do this using Burnside’s lemma.

As determined at In how many ways can we colour $n$ baskets with $r$ colours?, there are $(-1)^n(r-1)+(r-1)^n$ ways to select toppings from a choice of $r$ toppings for $n$ slices in a circle. Here $r=10$ and $n=8$, so that’s $(-1)^8(10-1)+(10-1)^8=43046730$, in agreement with Ross Millikan’s spreadsheet.

To find the number of rotationally inequivalent arrangements: The identity leaves all $43046730$ arrangements invariant; the rotation of order $2$ leaves $(-1)^4(10-1)+(10-1)^4=6570$ arrangements invariant; the $2$ rotations of order $4$ leave $(-1)^2(10-1)+(10-1)^2=90$ arrangements invariant, and the $4$ rotations of order $8$ leave $(-1)^1(10-1)+(10-1)^1=0$ arrangements invariant (because an arrangement left invariant by such a rotation would have to have all toppings the same and thus identical adjacent toppings). Thus by Burnside’s lemma there are

$$ \frac18(43046730+6570+2\cdot90)=5381685 $$

rotationally inequivalent arrangements, again in agreement with Ross Millikan’s answer.

joriki
  • 242,601