Processing math: 100%

Thursday, June 18, 2015

Sum involving golden ratio [Solution]

The problem was to find

Sn=nk=1[kφ]


where φ is the golden ratio and [x] is the integer part of x.

The challenge was to do it using polynomial in logn time.

Solution

If you look at the numbers of the form ak=[kφ] and *not* of the form [kφ], you will notice a pattern.

The pattern is as follows:

If ak=[kφ] and bk=ak+k, then we have that {a1,a2,}{b1,b2,}=N


i.e, the numbers not of the form [kφ], are precisely of the form [kφ]+k.

This observation can be proved using Beatty's theorem (and is not that difficult to prove).

Now, if you consider the numbers {1,2,,an} then these can be split into two disjoint sets {a1,a2,,an} and {b1,b2,,bm} for some m.

Thus we have that

1+2++an=Sn+mk=1bm=Sn+Sm+m(m+1)/2


Thus

Sn=n(n+1)/2m(m+1)/2Sm


which is a recursive formula for Sn. It can be shown that m=θ(n), and thus this recursive formula gives us a polynomial in logn time algorithm to compute Sn.

All we need to do is compute m. I will leave that to you.

No comments:

Post a Comment