Statistics

Problem Statement for "SquareDigitNumbers"

Problem Statement

You enjoy working with numbers that contain only square digits (namely, 0, 1, 4 and 9). The sequence containing only these digits is 0, 1, 4, 9, 10, 11, 14... Return the n-th term (indexed from 0) in this sequence.

Definition

Class:
SquareDigitNumbers
Method:
getNumber
Parameters:
int
Returns:
int
Method signature:
int getNumber(int n)
(be sure your method is public)

Constraints

  • n will be between 0 and 1000, inclusive.

Examples

  1. 0

    Returns: 0

    The first square digit number is 0.

  2. 5

    Returns: 11

  3. 16

    Returns: 100

  4. 121

    Returns: 1941

  5. 123

    Returns: 1949

  6. 1000

    Returns: 99440

    Maximum return

  7. 4

    Returns: 10

  8. 16

    Returns: 100

  9. 64

    Returns: 1000

  10. 256

    Returns: 10000

  11. 914

    Returns: 94104

  12. 788

    Returns: 90110

  13. 343

    Returns: 11119

  14. 857

    Returns: 91141

  15. 225

    Returns: 9401

  16. 89

    Returns: 1141

  17. 8

    Returns: 40

  18. 511

    Returns: 19999

  19. 255

    Returns: 9999

  20. 63

    Returns: 999

  21. 15

    Returns: 99

  22. 129

    Returns: 4001

  23. 456

    Returns: 19040

  24. 789

    Returns: 90111

  25. 101

    Returns: 1411

  26. 997

    Returns: 99411

  27. 954

    Returns: 94944

  28. 49

    Returns: 901

  29. 74

    Returns: 1044

  30. 800

    Returns: 90400

  31. 659

    Returns: 44109

  32. 291

    Returns: 10409

  33. 1

    Returns: 1

  34. 2

    Returns: 4

  35. 3

    Returns: 9

  36. 998

    Returns: 99414

  37. 996

    Returns: 99410

  38. 999

    Returns: 99419

  39. 10

    Returns: 44

  40. 714

    Returns: 49044

  41. 812

    Returns: 90490


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: