Statistics

Problem Statement for "RefactorableNumber"

Problem Statement

A refactorable number is defined to be a number that is divisble by the number of distinct factors that it has. Examples of refactorable numbers include 1 (1 factor), 12 (6 factors), and 9 (3 factors), but not 7 (2 factors) or 16 (5 factors).

You will be given two ints, low and high. Return the number of refactorable numbers between low and high, inclusive.

Definition

Class:
RefactorableNumber
Method:
count
Parameters:
int, int
Returns:
int
Method signature:
int count(int low, int high)
(be sure your method is public)

Constraints

  • low will be between 1 and 2,000,000, inclusive.
  • high will be between low and 2,000,000, inclusive.

Examples

  1. 1

    10

    Returns: 4

    There are 4 refactorable numbers between 1 and 10, namely: 1, 2, 8, and 9.

  2. 10

    100

    Returns: 12

  3. 25

    35

    Returns: 0

  4. 123

    4567

    Returns: 315

  5. 1

    2000000

    Returns: 85803

  6. 1

    10000

    Returns: 665

  7. 10000

    100000

    Returns: 4593

  8. 1

    18

    Returns: 6

  9. 18

    36

    Returns: 3

  10. 19

    35

    Returns: 1

  11. 100000

    2000000

    Returns: 80546

  12. 289383

    930885

    Returns: 27735

  13. 636915

    1692777

    Returns: 44072

  14. 238335

    1747793

    Returns: 63857

  15. 1760492

    1885384

    Returns: 5066

  16. 516649

    1641421

    Returns: 47138

  17. 490027

    1202362

    Returns: 30243

  18. 520059

    1368690

    Returns: 35776

  19. 897763

    1513926

    Returns: 25616

  20. 383426

    1180540

    Returns: 34021

  21. 89172

    1455736

    Returns: 58872

  22. 1005211

    1595368

    Returns: 24428

  23. 702567

    956429

    Returns: 10746

  24. 465782

    1021530

    Returns: 23734

  25. 722862

    1665123

    Returns: 39232

  26. 703135

    1174067

    Returns: 19828

  27. 1513929

    1979802

    Returns: 18980

  28. 1634022

    1723058

    Returns: 3657

  29. 1133069

    1898167

    Returns: 31409

  30. 1018456

    1961393

    Returns: 38779

  31. 175011

    478042

    Returns: 13581

  32. 1

    9

    Returns: 4

  33. 225

    225

    Returns: 1

  34. 1234567

    1234567

    Returns: 0

  35. 41

    41

    Returns: 0

  36. 1

    2

    Returns: 2

  37. 2865

    86457

    Returns: 4376

  38. 441

    441

    Returns: 1

  39. 1

    2000000

    Returns: 85803

  40. 1

    1999699

    Returns: 85790

  41. 1500000

    2000000

    Returns: 20362

  42. 13

    1987654

    Returns: 85298


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: