#G1098. B-smooth数

B-smooth数

[GESP202403 五级] B-smooth 数

题目描述

小杨同学想寻找一种名为 Bsmooth\tt B-smooth 数的正整数。

如果一个正整数的最大质因子不超过 BB,则该正整数为 Bsmooth\tt B-smooth 数。小杨同学想知道,对于给定的 nnBB,有多少个不超过 nnBsmooth\tt B-smooth 数。

输入格式

第一行包含两个正整数 nnBB,含义如题面所示。

输出格式

输出一个非负整数,表示不超过 nnBsmooth\tt B-smooth 数的数量。

输入输出样例

10 3
7

说明/提示

样例解释 1

在不超过 1010 的正整数中,3smooth\tt 3-smooth 数有 {1, 2, 3, 4, 6, 8, 9}\{1,\ 2,\ 3,\ 4,\ 6,\ 8,\ 9\},共 77 个。

数据规模与约定

子任务 得分 nn BB
11 3030 103 \le 10^3 1B1031 \le B \le 10^3
22 3030 106 \le 10^6 nB106\sqrt n \le B \le 10^6
33 4040 106 \le 10^6 1B1061 \le B \le 10^6

对全部的测试数据,保证 1n,B1061 \le n, B \le 10^6