Under construction

Still being built. Things may change

K-Sejun Numbers

Interview

Time limit2sMemory limit128 MB

Summary
Count integers from 1 to N whose every prime factor is at most K, given N up to 100000 and K up to 100.
Level

Easy3 of 10

Topics
Math, Number theory, Brute force
Solved
No attempts yet

Problem

O Sejun calls a positive integer a K-Sejun number if every prime factor of that integer is at most K.

The number 1 has no prime factors, so it is counted as a K-Sejun number for every K.

Write a program that counts how many positive integers at most N are K-Sejun numbers.

Input

The first line contains a positive integer N.

The second line contains a positive integer K.

N is at most 100,000, and K is at most 100.

Output

Print the number of K-Sejun numbers among the positive integers at most N.

Examples5

  1. Example 1

    Input
    10
    3
    
    Expected output
    7
  2. Example 2

    Input
    10
    4
    
    Expected output
    7
    
  3. Example 3

    Input
    15
    3
    
    Expected output
    8
    
  4. Example 4

    Input
    5
    20
    
    Expected output
    5
    
  5. Example 5

    Input
    100000
    100
    
    Expected output
    17442