Let's determine all real-valued functions $f$ defined on the positive integers such that for any positive integer $n$, the following holds:

$$
\frac{p}{f(1)+f(2)+\ldots+f(n)}=\frac{p+1}{f(n)}-\frac{p+1}{f(n+1)}
$$

where $p$ is a fixed positive number.
Solution. Let's choose the value of $f(1)$ to be any non-zero real number (otherwise we would divide by zero in the steps): let $f(1)=a$, where $a \neq 0$. Based on the relationship, we can calculate the first few values of $f$:

$$
\begin{aligned}
f(1)=a, & f(2)=(p+1) \cdot a, \quad f(3)=\frac{(p+1)(p+2)}{2} \cdot a \\
f(4) & =\frac{(p+1)(p+2)(p+3)}{6} \cdot a
\end{aligned}
$$

From these, we conjecture that if $n \geq 2$, then

$$
f(n)=\frac{(p+1)(p+2) \ldots(p+n-1)}{(n-1)!} \cdot a=\frac{(p+n-1)!}{p!(n-1)!} \cdot a=\binom{p+n-1}{p} a
$$

We prove this by induction. We have seen that it is true for $n=2,3,4$. Assume it is true up to $n$, and prove it for $n+1$. According to our assumption:

$$
\frac{p}{f(1)+f(2)+\ldots+f(n)}=\frac{p+1}{f(n)}-\frac{p+1}{f(n+1)}
$$

Substitute our inductive hypothesis (writing $f(1)$ as $\binom{p}{p} a$):

$$
\frac{p}{\binom{p}{p} a+\binom{p+1}{p} a+\ldots+\binom{p+n-1}{p} a}=\frac{p+1}{\binom{p+n-1}{p} a}-\frac{p+1}{f(n+1)}
$$

Apply the known

$$
\binom{p}{p}+\binom{p+1}{p}+\ldots+\binom{p+n-1}{p}=\binom{p+n}{p+1}
$$

relationship: Substituting this in:

$$
\begin{aligned}
\frac{p}{\binom{p+n}{p+1} a} & =\frac{p+1}{\binom{p+n-1}{p} a}-\frac{p+1}{f(n+1)} \\
\frac{p+1}{f(n+1)} & =\frac{p+1}{\binom{p+n-1}{p} a}-\frac{p}{\binom{p+n}{p+1} a}=\frac{(p+1) p!(n-1)!}{(p+n-1)!a}-\frac{p(p+1)!(n-1)!}{(p+n)!a}= \\
& =\frac{(p+n)(p+1)!(n-1)!-p(p+1)!(n-1)!}{(p+n)!a}= \\
& =\frac{n(p+1)!(n-1)!}{(p+n)!a}=\frac{(p+1)!n!}{(p+n)!a} \\
f(n+1) & =a \frac{(p+n)!}{p!n!}=a\binom{p+n}{p}
\end{aligned}
$$

This is exactly what we wanted to prove. This completes our inductive proof.

It is easily seen by substitution, but also from our previous proof, that the functions of the form we wrote do indeed satisfy the relationship for all $n$. Therefore, the functions that are suitable are exactly the following: $f(n)=\binom{p+n-1}{p} a$, where $a$ is any non-zero real number.