Given a number N ( Value can be large like N < 10^9 ) How can we calculate sum of the number of factors of first N numbers??
Example :
For n = 3
Answer:
= #f(1) + #f(2) + #f(3) --- { #f(n) -> number of factors of n }
= 1 + 2 + 2 = 5
Given a number N ( Value can be large like N < 10^9 ) How can we calculate sum of the number of factors of first N numbers??
Example :
For n = 3
Answer:
= #f(1) + #f(2) + #f(3) --- { #f(n) -> number of factors of n }
= 1 + 2 + 2
= 5
Copyright © 2021 JogjaFile Inc.
The answer is contained in the wikipedia article on the divisor function. In particular, using the traditional notation of $d(n)$ to represent the number of divisors of $n$, then $$ \sum_{n=1}^N d(n) = N \ln N + (2 \gamma - 1) N + O(\sqrt{N}), $$ where $\gamma \approx 0.5772$ is Euler's constant. The error can be improved, and conjecturally is $O(N^{1/4})$.