Statistics

Problem Statement for "SeventhPowers"

Problem Statement

Alice had some positive integer A with at most 500 digits. Bob looked at A and computed the number B: the sum of seventh powers of digits of A.

For example, if Alice had the number A = 407, Bob computed the number B = 4^7 + 0^7 + 7^7 = 839927.

You are given the number B. Find and return a String containing the decimal representation of any valid number A.

Definition

Class:
SeventhPowers
Method:
reconstructA
Parameters:
int
Returns:
String
Method signature:
String reconstructA(int B)
(be sure your method is public)

Notes

  • The answer always exists.
  • Any valid answer will be accepted. (Remember that A must have at most 500 digits.)
  • The String you return cannot have leading zeros.

Constraints

  • B will be between 1 and 10,000,000, inclusive.

Examples

  1. 839927

    Returns: "407"

  2. 130

    Returns: "121"

  3. 43740

    Returns: "33333333333333333333"

    20 * 3^7 = 43,740.

  4. 8484235

    Returns: "987665544433333322222222222222221111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"

  5. 127

    Returns: "1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"

  6. 1

    Returns: "1"

  7. 2

    Returns: "11"

  8. 3

    Returns: "111"

  9. 10

    Returns: "1111111111"

  10. 128

    Returns: "2"

  11. 129

    Returns: "21"

  12. 11511

    Returns: "3333322221111111111111111111111111111111111111111111111111111111111111111"

  13. 154272

    Returns: "5444433332222222222222211111111111111111111111111111111111111111111111111111111111111111111111"

  14. 397946

    Returns: "6544333222211111111111111111111111111111111111111111111"

  15. 559079

    Returns: "655544333332222222211111111111111111111111111111111111111111"

  16. 592882

    Returns: "66442111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"

  17. 687334

    Returns: "6654442111111111111111111111111111111111111111111111111111111111"

  18. 1049998

    Returns: "75544443322111111111111111111111111111111111111111"

  19. 1644279

    Returns: "76655543333222222222211111111111111111111111111111111111111111111111111111111111111111111111111111"

  20. 1719923

    Returns: "774444333222221111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"

  21. 2106533

    Returns: "8333322221111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"

  22. 3289054

    Returns: "8765333322222222222211111111111111"

  23. 3860547

    Returns: "8775443322222222111111111111111111"

  24. 3989646

    Returns: "8775553333311111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"

  25. 4004365

    Returns: "877555433332222111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"

  26. 4061905

    Returns: "87764433222211111111111111111111111111111111111111111111111111111111111111111111111111111"

  27. 4319923

    Returns: "8854433333322222222222211111111111111111111111111111111111111111111111111111111111111111111"

  28. 4426940

    Returns: "8855444433332222222222222222111111111111111111111111111111111111111111111111111111"

  29. 5295512

    Returns: "96554444333322222222222222221111111111111111111111111"

  30. 5603383

    Returns: "966555433332222222211111111111"

  31. 5737361

    Returns: "97544432222222222111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"

  32. 5763466

    Returns: "9755222221111111111111111111111111111111111111111111111111111111111111111"

  33. 5904000

    Returns: "97642222222221111111111111111"

  34. 5930950

    Returns: "97644333332222221111111111111111111111111111111"

  35. 6025398

    Returns: "9765444333332222211111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"

  36. 6278484

    Returns: "97665442222222221111111111111111111111111111111111111111111111111111111"

  37. 6486351

    Returns: "977444333222211111111111111111111111111111111111111111111111111111111111111111111111"

  38. 6584637

    Returns: "977544443333222222222222222211111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"

  39. 7022811

    Returns: "985444333333311111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"

  40. 7176605

    Returns: "98642111111111111111111111111111111111111"

  41. 7218327

    Returns: "986444333322111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"

  42. 7420237

    Returns: "9865554333322222111111111111111111111111111111111"

  43. 7612334

    Returns: "986655333333322222211111111111111"

  44. 8080114

    Returns: "9876542222222222222221111111111111111111111111111111111111111111111111111111111111111111111111111111111111"

  45. 8598389

    Returns: "9877444433222222222111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"

  46. 8623696

    Returns: "987754222222222222222111111111111111111111111111111111111111111111111111111111111"

  47. 8780007

    Returns: "987755542222222222222221111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"

  48. 9172898

    Returns: "98855443331111111111111111111111111111111111111111111111"

  49. 9289539

    Returns: "988643333333222211111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"

  50. 9359170

    Returns: "988654333222222111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"

  51. 9412106

    Returns: "9886544443333322111111111111111111111111111111111111111111111"

  52. 9523214

    Returns: "9886555433333322222222222222221111111111111111111111111111111111111111111111111111111111111111111111111111"

  53. 9577276

    Returns: "99333332221111111111111111111"

  54. 9649628

    Returns: "99533222222222111111111111111111111111111111111111111"

  55. 10000000

    Returns: "996544443333222222222222211111111111111111111111111111111111111111111111111111"

  56. 500

    Returns: "22211111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"

  57. 501

    Returns: "222111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"

  58. 499

    Returns: "2221111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"

  59. 4783469

    Returns: "922211111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"

  60. 4783470

    Returns: "9222111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"

  61. 4783471

    Returns: "92221111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"

  62. 7

    Returns: "1111111"


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: