I was in front of the stove making breakfast sausages this morning and I thought of a problem.
If I have 3 patties that need to be flipped, and after every pan flick somewhere between 1 and 3 random patties flip, how many flicks should I expect before all of the patties are flipped to the right orientation?
I'm sure this problem has been abstracted for coins or something, but I can't seem to think of how I put them together (especially because AT LEAST 1 patty is always flipped).
I see that logically about 1/3 of the time I get it first try (not my personal experience but lets assume I'm a better chef than that). but after that it looks like a Markov chain problem (right?). My programatic trials seem to suggest at mean of around 6, but how would I work this out on pen and paper?
Here is my simulation code
import random as rd
import seaborn as sns
import matplotlib.pyplot as plt
from tqdm import tqdm
total_trials = 1000000
hist_data = []
for _ in tqdm(range(total_trials)):
patty_list = [False, False, False]
num_attempts = 0
while not all(patty_list):
num_flips = rd.choice([1, 2, 3])
rd.shuffle(patty_list)
for i in range(num_flips):
patty_list[i] = not patty_list[i]
num_attempts += 1
hist_data.append(num_attempts)
sns.histplot(hist_data, bins=range(1, 100)).set(title=f'trials: {total_trials:,}\nmean: {sum(hist_data)/len(hist_data)}')
plt.show()
resulting in:
Edit: I think my code is wrong, as it does not account for the different permutations of flips. TTF = TFT = FTT despite those being 3 scenarios. Does that check out?
Edit 2: Does it make sense for me to assume N flips and then assign those flips randomly to pattys? Or do I have to assume that each patty has some probability of flipping? If I do the latter, is it just magic that they never all-not-flip?
Edit 3: Thanks all for the thoughtful approach to my breakfast problem. I've learned a lot about the consequences of not defining my problem well! There are a lot of great answers here and since they're all right from a different point of view (I'll define better next time) I'm going to mark the first answer given as the correct. Thanks again all!

We use the random patty selection implied by the code, where first a nonzero number and then a set of indices of patties to flip are chosen uniformly at random.
Let $E(n)$ denote the expected number of flips needed to get all patties face up from a state where $n$ are face down. One-flip considerations lead to this linear system: $$E(3)=1+\frac13E(2)+\frac13E(1)+\frac13E(0)$$ $$E(2)=1+\frac13\left(\frac23E(1)+\frac13E(3)\right)+\frac13\left(\frac23E(2)+\frac13E(0)\right)+\frac13E(1)$$ $$E(1)=1+\frac13\left(\frac23E(2)+\frac13E(0)\right)+\frac13\left(\frac23E(1)+\frac13E(3)\right)+\frac13E(2)$$ $$E(0)=0$$ The initial $1$ comes from having to make at least one more flick if $n>0$. The outer factors of $\frac13$ come from choosing the number of patties to flip. Now suppose (with arbitrary patty total) the choice is made to to flip $n$ patties out of $N$, of which $K$ are face down. The probability of flipping $k$ face down patties up (and hence flipping $n-k$ face up ones down) is given by the hypergeometric distribution: $$\binom Kk\binom{N-K}{n-k}\Bigg/\binom Nn$$ This leads to the inner terms in each equation above.
Solving the system gives $E(3)=6$ as the expected number of flicks needed to flip everything face up, agreeing with your code. $E(1)=E(2)=\frac{15}2$.