#SP0000249. Đếm các số P-trơn (P-smooth number)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Đếm các số P-trơn (P-smooth number)
P-smooth number
Source: AtCoder
Version: Phuoc Hung OJ Extended
Problem Statement
A positive integer is called -smooth if none of its prime factors exceeds . By convention, is -smooth for every prime , as it has no prime factors.
Given a positive integer and a prime number , count positive integers such that and every prime divisor of is at most .
Print the exact integer answer without taking any modulus.
Input
The only line contains two integers and . The value is guaranteed to be prime.
Output
Print a single integer: the exact number of -smooth integers in the interval . No modulus is applied.
Subtasks
- Subtask 1 (20 points): ; and is prime.
- Subtask 2 (30 points): ; and is prime.
- Subtask 3 (50 points): ; and is prime.
Examples
Input
36 3
Output
14
Explanation
For and , the only permitted prime factors are and . Every counted integer is for . Group by the exponent of : yields (six numbers); yields (four); yields (three); yields (one). Higher powers of exceed . Total . The integer is included.