Expected happiness with meal quality I came across this rather strange problem in a book on Algorithms (I'm rather weak in this subject, you know):
There is a well-known city (which will go nameless here) whose inhabitants     
have the reputation of enjoying a meal only if that meal is the best they 
have ever experienced in their life. Otherwise, they hate it. Assuming meal 
quality is distributed uniformly across a person’s life, describe the 
expected number of times inhabitants of this city are happy with their 
meals?

The part troubling me most is "Assuming meal quality is distributed uniformly across a person’s life" -- what am I to make of it? If I think of the problem in simplistic terms, it seems that the average inhabitant will enjoy a meal only if it outclasses every previous meal. So, the first time he has a meal, he'll definitely be delighted. But then what? It is indeed possible that better and better meals keep coming his way, which means if he lives for x days and eats three times a day, it is possible for him to be happy 3*x times in his life.
I'm convinced this is not the right answer. At some level the problem resembles induction, but I'm not sure. How do I go about it?
 A: Assume that meal qualities are uniformly distributed on $(0,1)$.  Let $E(q,N)$ be the expected number of "best meals" (i.e., new records) remaining in $N$ trials given that the current best is $q$.  The probability that the very next meal is a new best is $1-q$, and in that case its quality is uniformly distributed in $(q,1)$:
$$
E(q,N) = qE(q,N-1) + (1-q)\left(1+\frac{1}{1-q}\int_{q}^{1}E(q',N-1)dq'\right) \\
=qE(q,N-1) + (1-q)+\int_{q}^{1}E(q',N-1)dq'.
$$
Taking the derivative of this with respect to $q$ gives
$$
E'(q,N)=E(q,N-1)+qE'(q,N-1)-1-E(q,N-1)=qE'(q,N-1)-1.
$$
With the boundary conditions that $E(q,0)=0$ and $E(1,N)=0$, this recurrence gives
$$
E'(q,N)=-(1+q+q^2+\ldots+q^{N-1}).
$$
Taking the integral at $q=0$ gives
$$
E(0,N)=1+\frac{1}{2}+\frac{1}{3}+\ldots+\frac{1}{N} \sim \log N  + \gamma.
$$
So there's a weak dependence on how long you live.... assuming you live $75$ years and eat $3$ meals a day, this is
$$
E(0,75\times 365 \times 3)\approx 12
$$
best meals ever.
A: Let $X_i$ a sequence of indipendent variables uniformly distribuited over $(0,1)$. The variable $X_i$ denote the quality of the $i$-esim meal of a person. The probaility for an inhabitant to be happy at the $n$-esim meal is $P(X_n>X_i\, ,\forall i<n)=1/n$. So the expected value of happy meal is
$$\sum_{n=1}^N\frac{1}{n}$$
where $N$ is the total number of meal in the life.
