Let $~m~$ and $~n~$ be positive integers. Let's call (my term - not sure there is any official term for such thing) number $~m~$ a "strange divisor" of number $~n~$ if dividing $~n~$ by $~m~$ we get equall quotient and remainder.
For example $~7 = 6\cdot 1 + 1~$ so $~6~$ is a strange divisor of $~7~$. As another example $~15 = 4\cdot3 + 3~$ so $~4~$ is strange divisor of $~15$.
From my definition above we can deduce that $~m~$ is a strange divisor of $~n~$ iff there exists number $~0 \leq r < m~$ such that $~n = (m + 1)r$. Let's denote by $~f(n)~$ the number of all strange divisors of number $~n$. I wonder what is the average value of $~f(n)~$ so i need an efficient way to compute $~\sum_{n=1}^{N} f(n)~$. Any ideas how to do it fast will be highly appreciated. I think that there must be some way to reduce upper limit from $~N~$ to $~\sqrt{N}~$ since we work with divisors. But i don't see the way to do it.
Let's work backwards:
m is a strange divisor of a number n, iff:
Which means, for a number m, it's a strange divisor of m+1, 2*(m+1), 3*(m+1).... (m-1)*(m+1), which is exactly m-1 numbers.
If we cap "strange dividends" of m to be less than some fixed number N, then m will be a strange divisor of:
min(floor($\frac{N}{(m+1)}$), m-1) numbers.
Roughly, for values of m < sqrt(n), the expression is m-1. For values of m > sqrt(n), the expression is floor(N/(m+1))
I make the following claim:
$\sum_{i=1}^N \text{(number of strange divisors of i)} = \sum_{m=1}^N \text{(number of numbers for which m is a strange divisor)}$
So our sum is:
$\sum_{i=1}^{N} f(i) = \sum_{m=1}^{N} min(floor(\frac{N}{(m+1)}), m-1)$
$ \approx (\sum_{m=1}^{floor(\sqrt{N})} m - 1) + (\sum_{m=floor(\sqrt{N})}^N floor(\frac{N}{m+1})) $
$ \approx (floor(\sqrt{N}))*(floor(\sqrt{N}) - 1) * \frac{1}{2}$ + $ N*H_N - floor(\sqrt{N})*H_{floor(\sqrt{N})} $
where $H_k$ is the $k^{th}$ harmonic number
Note: this value is not exactly the same as the sum of # divisors of numbers from 1 to N, because not every divisor d corresponds to a strange divisor d-1 (It has to satisfy N/d < d-1)