Statistics

Problem Statement for "SmoothNumbers"

Problem Statement

A positive integer is said to be k-smooth if its largest prime factor is no greater than k. Compute how many positive integers less than or equal to N are k-smooth.

Definition

Class:
SmoothNumbers
Method:
countSmoothNumbers
Parameters:
int, int
Returns:
int
Method signature:
int countSmoothNumbers(int N, int k)
(be sure your method is public)

Constraints

  • N will be between 1 and 100,000, inclusive.
  • k will be between 1 and 100, inclusive.

Examples

  1. 10

    3

    Returns: 7

    Of the first ten integers, only 5, 7 and 10 have prime factors greater than 3.

  2. 10

    4

    Returns: 7

    4 is not prime, so 4-smooth numbers are the same as 3-smooth numbers.

  3. 15

    3

    Returns: 8

  4. 5

    20

    Returns: 5

  5. 100000

    100

    Returns: 17442

  6. 1

    1

    Returns: 1

  7. 1

    100

    Returns: 1

  8. 100000

    1

    Returns: 1

  9. 2

    2

    Returns: 2

  10. 99999

    100

    Returns: 17441

  11. 99999

    96

    Returns: 16760

  12. 99999

    97

    Returns: 17441

  13. 96

    97

    Returns: 96

  14. 96

    96

    Returns: 96

  15. 121

    11

    Returns: 61

  16. 168

    13

    Returns: 87

  17. 50

    7

    Returns: 31

  18. 50000

    10

    Returns: 566

  19. 65536

    2

    Returns: 17

  20. 2

    1

    Returns: 1

  21. 99999

    1

    Returns: 1

  22. 100000

    4

    Returns: 101

  23. 10

    1

    Returns: 1

  24. 100

    1

    Returns: 1

  25. 1000

    1

    Returns: 1

  26. 15

    1

    Returns: 1


This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2024, TopCoder, Inc. All rights reserved.
This problem was used for: