Fraction Floor Sum

AtCoder
IDabc230_e
Time2000ms
Memory256MB
Difficulty
Given is a positive integer $N$. Find the value $\displaystyle\sum_{i=1}^N \left[ \frac{N}{i} \right]$. Here, for a real number $x$, $[x]$ denotes the largest integer not exceeding $x$. ## Constraints * $1 \leq N \leq 10^{12}$ * $N$ is an integer. ## Input Input is given from Standard Input in the following format: $N$ [samples]
Samples
Input #1
3
Output #1
5

We have $\left[ \frac{3}{1} \right]+\left[ \frac{3}{2} \right]+\left[ \frac{3}{3} \right]=3+1+1=5$.
Input #2
10000000000
Output #2
231802823220

Note that the input and output may not fit into a $32$\-bit integer type.
API Response (JSON)
{
  "problem": {
    "name": "Fraction Floor Sum",
    "description": {
      "content": "Given is a positive integer $N$. Find the value $\\displaystyle\\sum_{i=1}^N \\left[ \\frac{N}{i} \\right]$. Here, for a real number $x$, $[x]$ denotes the largest integer not exceeding $x$.",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "abc230_e"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Given is a positive integer $N$. Find the value $\\displaystyle\\sum_{i=1}^N \\left[ \\frac{N}{i} \\right]$.\nHere, for a real number $x$, $[x]$ denotes the largest integer not exceeding $x$.\n\n## Constraint...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments