No.2645 Sum of Divisors?
Problem Statement
For a positive integer $n$, let $d(n)$ denote the number of positive divisors of $n$.
Given a positive integer $N$, find the following value.
$$\sum_{k=1}^{N} \frac{d(k)}{k}$$
Constraints
- $1 \le N \le 10^{12}$
Input
$N$
Output
Output the value of $\sum_{k=1}^{N} \frac{d(k)}{k}$. Your output is judged as correct if its relative error or absolute error from the intended solution is at most $10^{-6}$. The intended solution is guaranteed to have an absolute error or relative error of at most $10^{-32}$ from the true value.
Sample
Sample 1
Input
6
Output
4.483333333333333
The values of $d(k)/k$, in order of $k=1,2,\dots$, are as follows.
$$\frac{d(1)}{1} = 1$$ $$\frac{d(2)}{2} = 1$$ $$\frac{d(3)}{3} = \frac{2}{3}$$ $$\frac{d(4)}{4} = \frac{3}{4}$$ $$\frac{d(5)}{5} = \frac{2}{5}$$ $$\frac{d(6)}{6} = \frac{2}{3}$$
Output their sum, $269/60 = 4.48333\cdots$.
Sample 2
Input
998244
Output
111.83577968031178
Sample 3
Input
314159265358
Output
381.4545183502939
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
noya2