A very hard mathematic problem

HDU - 4282