human
What is a code to palindromic Primes and the other steps required given the following:
Palindromic Primes | A function that returns true only if num contains one digit.
comparison operation is faster than division operation . So using following instead of " return ▁ num ▁ / ▁ 10 ▁ = = ▁ 0.
".
A recursive function to find out whether num is palindrome or not . Initially , dupNum contains address of a copy of num ..
Base case ( needed for recursion termination ) : This statement / mainly compares the first digit with the last digit.
This is the key line in this method . Note that all recursive / calls have a separate copy of num , but they all share same copy of dupNum . We divide num while moving up the recursion tree.
The following statements are executed when we move up the recursion call tree.
At this point , if num % 10 contains ith digit from beginning , then ( dupNum ) % 10 contains ith digit from end.
The main function that uses recursive function isPalUtil ( ) to find out whether num is palindrome or not.
If num is negative , make it positive.
Create a separate copy of num , so that modifications made to address dupNum don 't change the input number.  dupNum = num.
dupNum = num.
Function to generate all primes and checking whether number is palindromic or not.
Create a boolean array " prime [ 0 . . n ] " and initialize all entries it as true . A value in prime [ i ] will finally be false if i is Not a prime , else true ..
If prime [ p ] is not changed , then it is a prime.
Update all multiples of p.
Print all palindromic prime numbers.
checking whether the given number is prime palindromic or not.
Driver Code"
Solution in Python:
assistant
#Here is code to palindromic Primes and the other steps required.
 def oneDigit ( num ) :
	return ( num >= 0 and num < 10 ) ;
def isPalUtil ( num , dupNum ) :
	if ( oneDigit ( num ) ) :
		return ( num == ( dupNum ) % 10 ) ;
	if ( not isPalUtil ( int ( num / 10 ) , dupNum ) ) :
		return False ;
	dupNum = int ( dupNum / 10 ) ;
	return ( num % 10 == ( dupNum ) % 10 ) ;
def isPal ( num ) :
	if ( num < 0 ) :
		num = - num ;
	return isPalUtil ( num , dupNum ) ;
def printPalPrimesLessThanN ( n ) :
	prime = [ True ] * ( n + 1 ) ;
	p = 2 ;
	while ( p * p <= n ) :
		if ( prime [ p ] ) :
			for i in range ( p * 2 , n + 1 , p ) :
				prime [ i ] = False ;
		p += 1 ;
	for p in range ( 2 , n + 1 ) :
		if ( prime [ p ] and isPal ( p ) ) :
			print ( p , end = " ▁ " ) ;
n = 100 ;
print ( " Palindromic ▁ primes ▁ smaller " , " than ▁ or ▁ equal ▁ to " , n , " are ▁ : " ) ;
printPalPrimesLessThanN ( n ) ;