Problems > The K-th Squarefree Number

The K-th Squarefree Number

Difficulty: 2100 6000 ms 128 MB

binary-search number-theory mobius

A number is squarefree if no perfect square > 1 divides it (1, 2, 3, 5, 6, 7, 10, ...). Print the K-th squarefree number.

Input: one integer K.

Output: the K-th squarefree number.

Constraints:

  • 1 ≤ K ≤ 1011

Sample Tests

Input 1
5
Output 1
6
Input 2
1
Output 2
1

Read the Editorial

Discussion (opens after you solve — no spoilers before)

No comments yet.

Submit Your Solution

Log in or create a free account to run and submit code.