eolymp
bolt
Try our new interface for solving problems
Problems

Stepan and pairs

Stepan and pairs

Stepan is interested in the greatest common divisor of a pair of numbers, specifically $GCD(x, y)$. Given an integer $n$, Stepan wants to know how many pairs of integers $(i, j)$ exist such that $1 \le i, j \le n$ and the equation $i = GCD(i, j)$ is satisfied. \InputFile One integer $n\:(1 \le n ≤ 10^6)$. \OutputFile Print the number of required pairs.
Time limit 1 second
Memory limit 128 MiB
Input example #1
1
Output example #1
1
Input example #2
4
Output example #2
8
Input example #3
10
Output example #3
27

Example description: In the first example a suitable pair is (1, 1), because GCD(1, 1) = 1. In the second example, 8 pairs of numbers are suitable: (1, 1), (1, 2), (1, 3), (1, 4), (2, 2), (2, 4), (3, 3), (4, 4).

Source 2012-2013 III stage of All-Ukrainian school Olympiad, Day 1