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