Метод расширения Iterate может выглядеть так:
public static IObservable<T> Iterate<T, TIter>([NotNull] this IObservable<TIter> source, [NotNull] T iterationStart, [NotNull] Func<TIter, T, T> iterator)
{
return Observable.Create<T>(observer =>
{
T previousElement = iterationStart;
return source.Subscribe(
value =>
{
T currentElement = iterator(value, previousElement);
observer.OnNext(currentElement);
previousElement = currentElement;
},
observer.OnError,
observer.OnCompleted
);
}).StartWith(iterationStart);
}