#include <iostream>
#include<cmath>
#include<ctime>
#include<string>
#include <iomanip>
#include <fstream>
using namespace std;
bool primeNumber(int n);
bool Emirp(int n);
int reversal(int n);
int recursive(int a, int b);
int main()
{
	
	int count = 0;
	int number = 13;
	while (count <= 100)
	{
		if (Emirp(number))
		{
			count++;
			if (count % 10 == 0)
				cout << setw(7) << number << endl;
			else
				cout << setw(7) << number;
		}
		number++;
	}
		
}
bool primeNumber(int n) {
	
		for (int i = 2; i <= n / 2; i++) {
			
			if (n % i == 0) {
				return false;
			}
		}
		return true;
}
bool Emirp(int n) {
	
	return primeNumber(n) && primeNumber(reversal(n));
	
}
int reversal(int n) {
	
		if (n < 10) {
			
				return n;
			
		}
		return recursive(n % 10, n / 10);
	
}
int recursive(int a, int b) {
	if (b < 1) {
		return a;
	}
	return recursive(a * 10 + b % 10, b / 10);
	
}
	
   
                
            Preview:
        downloadDownload PNG
        downloadDownload JPEG
                        downloadDownload SVG
        
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter