Palindromes with Three Prime Divisors


Submit solution

Points: 100
Time limit: 2.0s
Memory limit: 256M

Author:
Problem types

List the palindromes in \([a,b]\) having at least three distinct prime divisors.

Input

One line containing \(a\) and \(b\).

The input satisfies:

  • \(1 \le a \le b \le 10^7\)

Output

Print qualifying numbers in increasing order, separated by single spaces; print -1 if none exist.

Example

Input
9357341 9907851
Output
9358539 9359539 9362639 9363639 9366639 9369639 9370739 9371739 9373739 9374739 9376739 9377739 9380839 9381839 9385839 9386839 9387839 9390939 9391939 9393939 9394939 9396939 9398939 9399939 9401049 9402049 9403049 9406049 9407049 9408049 9409049 9410149 9411149 9412149 9417149 9418149 9420249 9422249 9423249 9426249 9427249 9428249 9429249 9431349 9435349 9436349 9437349 9438349 9442449 9443449 9445449 9448449 9449449 9450549 9453549 9456549 9458549 9459549 9461649 9462649 9463649 9464649 9468649 9472749 9474749 9475749 9478749 9479749 9480849 9483849 9487849 9490949 9491949 9496949 9497949 9499949 9502059 9503059 9508059 9511159 9512159 9515159 9516159 9518159 9519159 9520259 9521259 9524259 9527259 9532359 9533359 9534359 9535359 9537359 9538359 9541459 9543459 9544459 9545459 9546459 9549459 9550559 9551559 9554559 9557559 9559559 9563659 9564659 9565659 9567659 9569659 9570759 9572759 9573759 9575759 9579759 9581859 9582859 9584859 9587859 9589859 9590959 9592959 9593959 9596959 9599959 9600069 9603069 9606069 9609069 9611169 9616169 9617169 9618169 9619169 9621269 9623269 9625269 9628269 9630369 9639369 9641469 9643469 9644469 9647469 9648469 9652569 9655569 9656569 9658569 9659569 9660669 9662669 9663669 9664669 9665669 9667669 9668669 9674769 9675769 9677769 9680869 9682869 9684869 9685869 9689869 9690969 9691969 9692969 9693969 9694969 9697969 9698969 9701079 9703079 9704079 9710179 9712179 9716179 9720279 9722279 9725279 9729279 9731379 9734379 9736379 9737379 9738379 9740479 9742479 9744479 9745479 9746479 9748479 9750579 9751579 9753579 9756579 9757579 9759579 9761679 9765679 9768679 9772779 9774779 9775779 9777779 9783879 9786879 9789879 9790979 9794979 9799979 9800089 9802089 9804089 9805089 9813189 9814189 9815189 9816189 9824289 9826289 9827289 9829289 9832389 9838389 9839389 9840489 9843489 9849489 9850589 9851589 9854589 9857589 9858589 9861689 9863689 9865689 9866689 9872789 9873789 9875789 9876789 9879789 9881889 9884889 9887889 9890989 9892989 9895989 9897989 9898989 9899989 9900099 9903099 9904099 9905099 9906099

Comments

There are no comments at the moment.