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
  • Practice
  • Certification
  • Compete
  • Career Fair
  • Hiring developers?
  1. All Contests
  2. ProjectEuler+
  3. Project Euler #49: Prime permutations

Project Euler #49: Prime permutations

Problem
Submissions
Leaderboard
Discussions

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

The arithmetic sequence, in which each of the terms increases by is unusual in two ways: (i) each of the three terms are prime, and, (ii) each of the 4-digit numbers are permutations of one another.

There are no arithmetic sequences made up of three , , or primes, exhibiting this property.
You are given and , find all size sequences where first element is less than and elements are permutations of each other, are prime and are in AP(Arithmetic Progression).

Print the answer as concatenated integer formed by joining terms.

Input Format

Input contains two integers and

Constraints


Output Format

Print the answer corresponding to the test case. each in new line in numerically sorted order of smallest value.

Sample Input

2000 3

Sample Output

148748178147

Author

shashank21j

Difficulty

Hard

Max Score

100

Submitted By

892

Need Help?


View discussions
View top submissions

rate this challenge

MORE DETAILS

Download problem statement
Download sample test cases
Suggest Edits

Choose a translation


  • Contest Calendar
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy
  • Request a Feature