Monday, 9 September 2013

Sum of series such as n+n/2+n/3+n/4...n/n.I need only the quotient of each term and not the full value with decimal.In c++ [on hold]

Sum of series such as n+n/2+n/3+n/4...n/n.I need only the quotient of each
term and not the full value with decimal.In c++ [on hold]

This is what i did.n+n/2+n/3+n/4+n/5...n+n>=n+n/2+n/2.The value of n can
be upro 10^9 and it should be executed within 1 sec i.e 10^8 operations
per second.I calculated the nearest power of 2 to n.and then did n/2 for
each power of 2 and then added the remaining to the ans..But it didn't
work for large numbers.Please help

No comments:

Post a Comment