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

    HackerRank

  • |
  • Prepare
  • Certify
  • Compete
  • Apply
  • Hiring developers?
  1. All Contests
  2. ProjectEuler+
  3. Project Euler #52: Permuted multiples

Project Euler #52: Permuted multiples

Contest ends in
Problem
Submissions
Leaderboard
Discussions

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

It can be seen that the number, , and its double, , contain exactly the same digits, but in a different order.

Given N, find all the positive integers, , such that contain the same digits.

Input Format

Input contains two integers and

Constraints


Output Format

Print all the multiple corresponding to the test case. If there are more than 1 print each of them in a new line.

Note1: It is guaranteed a solution exists.
Note2: You should not consider solution with leading 0's.

Sample Input

125875 2

Sample Output

125874 251748

Author

shashank21j

Difficulty

Easy

Max Score

100

Submitted By

2824

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