#P9118. Counting Perfect Powers

    ID: 22277 Type: Default 1000ms 256MiB

Counting Perfect Powers

Counting Perfect Powers

In this problem, you are given two positive integers n and k. You are asked to determine the number of integers x in the range [1, n] such that there exist positive integers a and b satisfying

$$x = a^b, \quad b \ge k, \quad a,b \in \mathbb{N}^+. $$

Recall that for any a,b in \(\mathbb{N}^+\), the power is defined as

$$a^b = \underbrace{a \times a \times \cdots \times a}_{b \text{ times}}. $$

Note that every positive integer m can be represented as \(m^1\), but here the representation must use an exponent at least k. Solve for the total number of such x in the interval [1, n].

inputFormat

The input consists of a single line containing two space-separated positive integers n and k.
Constraints (for example):
1 ≤ n ≤ 1012, 1 ≤ k ≤ 50.

outputFormat

Output a single integer representing the number of positive integers x in [1, n] that can be written in the form \(x = a^b\) with bk.

sample

100 2
13