#include<bits/stdc++.h> using namespace std; bool Is_Prime(int num){ bool ans=1; for(int i=2;i<=sqrt(num);i++){ if(num%i==0){ ans=0; break; } } return num=1?0:ans; } int reverse(int n){ int b=0,new_num=0; while(n>0){ b=n%10; new_num=new_num*10+b; n/=10; } return new_num; } int main(){ int M,N; cin>>M>>N; for(int i=M;i<=N;i++){ if(Is_Prime(i)==1&&Is_Prime(reverse(i))==1) } cout<<i<<" "; return 0; }

0 comments

No comments so far...