Range of periodic sequence (noch nicht übersetzt)

Problem 729

Consider the sequence of real numbers an defined by the starting value a0 and the recurrence an+1=an1an for any n0.

For some starting values a0 the sequence will be periodic. For example, a0=12 yields the sequence: 12,12,12,

We are interested in the range of such a periodic sequence which is the difference between the maximum and minimum of the sequence. For example, the range of the sequence above would be 12(12)=2.

Let S(P) be the sum of the ranges of all such periodic sequences with a period not exceeding P.
For example, S(2)=222.8284, being the sum of the ranges of the two sequences starting with a0=12 and a0=12.
You are given S(3)14.6461 and S(5)124.1056.

Find S(25), rounded to 4 decimal places.