# The Pizza Algorithm

## aka How many pizza's do I need to order to feed n adults?

Back to main page

Maybe your experiences are different than mine but I have found that I spent a lot of time trying to order pizzas for a group of people. And discussing what kind of pizzas to buy. And how many to buy. And sometimes running out, and sometimes having pizza left over, and often times running out of popular pizza and having leftover unpopular pizza. And being a Software Engineer with every core of my being I developed an algorithm for it which has proven of enough use that I am tired of rewriting it and emailing it so hence this page. Remember your mileage will vary. My mileage even varies - when with kids pizza 1 and 2 are swapped, when with my wife mushrooms fall off of the ANSI standard. So...

Figure on
`1 large pizza (16 inches) for every (n+1)/4 people rounding up`
or
`1 medium pizza (12 inches) for every (n+1)/3 people rounding up`
so
```
1-3 people = 1 large pizza
4-7 people = 2 large pizzas
8-11 people = 3 large pizzas
12-15 people = 4 large pizzas
16-19 people = 5 large pizzas
```
or
```
1-2 people = 1 medium pizza
3-5 people = 2 medium pizzas
6-8 people = 3 medium pizzas
9-11 people = 4 medium pizzas
```
And if you want there to be leftover pizza just add
n
people...

• Pizza 1 = ANSI Standard Pizza = Pepperoni and Mushrooms
• Pizza 2 = Veggie = Green Peppers and Mushrooms
• Pizza 3 = Sausage Only = This is the experimental pizza - replace this with some funky pizza that has up to 2 toppings but no onions or olives
• Pizza 4 = Cheese Only
• Pizza 5 = Pepperoni Only
• Pizza 6 repeats pizza 1.
• Pizza 7 repeats pizza 2 or some other veggie combo (with up to 2 toppings but no onions or olives)

and so on.

Assumptions:
• Anything over 2 toppings and the pizza is left over.
• Anything with onions or olives and the pizza is left over.

mjf