We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • Hackerrank Home
  • Prepare
    NEW
  • Certify
  • Compete
  • Career Fair
  • Hiring developers?
  1. All Contests
  2. ProjectEuler+
  3. Project Euler #62: Cubic permutations

Project Euler #62: Cubic permutations

Problem
Submissions
Leaderboard
Discussions

This problem is a programming version of Problem 62 from projecteuler.net

The cube, , can be permuted to produce two other cubes: and .

In fact, is the smallest cube which has exactly three permutations of its digits which are also cube.

You are given , find the smallest cube for which exactly permutations of its digits are cube of some number which is . If there are multiple sets, print the minimal element of each in sorted order.

Input Format

Input contains two space separated integers and .

Constraints


Output Format

Print the answer corresponding to the test case. If there are more than one number, print them on separate lines.

Sample Input

1000 3

Sample Output

41063625

Author

shashank21j

Difficulty

Easy

Max Score

100

Submitted By

1580

Need Help?


View discussions
View top submissions

rate this challenge

MORE DETAILS

Download problem statement
Download sample test cases
Suggest Edits

Choose a translation


  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy