#B3969. Counting B-smooth Numbers
Counting B-smooth Numbers
Counting B-smooth Numbers
A positive integer is called B-smooth if all of its prime factors are less than or equal to \(B\). In other words, if the largest prime factor of a positive integer \(x\) satisfies \(P \leq B\), then \(x\) is a \(B\)-smooth number.
Given two integers \(n\) and \(B\), your task is to count the number of \(B\)-smooth numbers that do not exceed \(n\). Note that the number \(1\) is considered \(B\)-smooth since it has no prime factors.
inputFormat
The input consists of a single line with two space-separated integers: \(n\) and \(B\).
\(n\) is the upper bound and \(B\) is the maximum allowed prime factor.
outputFormat
Output a single integer, the count of \(B\)-smooth numbers that are less than or equal to \(n\).
sample
10 3
7