classSolution:defisPalindrome(self,n):if n <0or (n %10==0and n !=0):returnFalse left = n right =0while left > right: right = right *10+ left %10 left //=10return left == right or left == right //10defisPrimeNumber(self,n):return n >1andall(n % d for d inrange(2, int(n**.5) +1))defprimePalindrome(self,n:int) ->int:whileTrue:if self.isPalindrome(n)and self.isPrimeNumber(n):return n n +=1if10**7< n <10**8: n =10**8