Divisors [III]
The blurb for this problem is the same as Divisors [I], save for the statement of the problem.
Consider the sequence of all natural numbers, and then for each number, listing each of the divisors of this number in increasing order:
becomes:
Since this (infinite) sequence has a lot of duplicates, we can notate for each digit whether it is the first, second, third... occurence using a subscript:
For this third problem, we are considering taking the reciprocal of every value in this sequence, and summing it:
For this problem, we want you to estimate the value of the partial sum up to and including some (The first occurence of some value )
Input
Input will contain a single value i
, representing the sequence value
Output
Output an estimate of the partial sum up to and including the first occurence of .
In order to receive of the grade, your solution should have maximum error at most .
In order to be judged as correct and receive full marks, your solution should have maximum error at most . For reference, this error looks like the following (note the logarithmic axis):
Constraints
Example
Input
5
Output
6.783333333333333
Although anything from this answer would suffice.
Comments