Backwards Read Primes are primes that when read backwards in base 10 (from right to left) 
are a different prime. (This rules out primes which are palindromes.)
```
Examples:
13 17 31 37 71 73 are Backwards Read Primes
```
13 is such because it's prime and read from right to left writes 31 which is prime too. Same for the others.

## Task
Find all Backwards Read Primes between two positive given numbers (both inclusive), the second one always being greater than or equal to the first one. The resulting array or the resulting string will be ordered following the natural order of the prime numbers.

## Example

backwardsPrime(2, 100) => [13, 17, 31, 37, 71, 73, 79, 97] 
backwardsPrime(9900, 10000) => [9923, 9931, 9941, 9967]
backwardsPrime(501, 599) => []

## Note for Forth
Return only the first backwards-read prime between start and end
or 0 if you don't find any

```python
backwards_prime(2, 100) => [13, 17, 31, 37, 71, 73, 79, 97] 
backwards_prime(9900, 10000) => [9923, 9931, 9941, 9967]
```

Difficulty: introductory

Starter code:

def backwardsPrime(start, stop):
	

Solutions:
def backwardsPrime(start, stop):
    primes = []
    for n in range(start, stop+1):
        if n not in primes and is_prime(n) and is_prime(reverse(n)) and n != reverse(n):
            primes.append(n)
            if start <= reverse(n) <= stop:
                primes.append(reverse(n))
    return sorted(primes)

def is_prime(n):
    for i in range(2, int(n**(0.5))+1):
        if n % i == 0:
            return False
    return True

def reverse(n):
    return int(''.join(str(n)[::-1]))

def backwardsPrime(start, stop):
    is_prime = lambda n : all(n % a for a in range(3, 1 + int(n ** 0.5), 2)) if n > 2 and n % 2 else n == 2
    
    return [n for n in range(start + ~start % 2, stop + 1, 2) if is_prime(n) and n != int(str(n)[::-1]) and is_prime(int(str(n)[::-1]))]

def prime(a):
    if a == 2: return True
    if a < 2 or a % 2 == 0: return False
    return not any(a % x == 0 for x in range(3, int(a**0.5) + 1, 2))
    
def backwardsPrime(start, nd):
    return [x for x in range(start, nd + 1) if (str(x) != str(x)[::-1]) and prime(x) and prime(int(str(x)[::-1])) ]


def backwardsPrime(start, stop):
    return [x for x in range(start, stop+1) if is_prime(x) and is_prime(int(str(x)[::-1])) and str(x) != str(x)[::-1]]

def is_prime(n):
    return all(n%x for x in range(2, int(n**.5+1)))

from math import sqrt; from itertools import count, islice

def isPrime(n):
    return n > 1 and all(n%i for i in islice(count(2), int(sqrt(n)-1)))

def backwardsPrime(a,b):
    return[x for x in range(a, b+1) if isPrime(x) and x > 10 and isPrime(int(str(x)[::-1])) and (int(str(x)[::-1]) != x)]

import math

KnownPrimes = []

def backwardsPrime(start, stop):    
    k = math.ceil((start - 1)/6)
    Prime,p1,p2 = [],0,0 
    
    while p1<=stop or p2<=stop: 
        p1, p2 = 6*k - 1, 6*k + 1
        p1x = int(str(p1)[::-1])
        p2x = int(str(p2)[::-1])
        
        if not(p1 == p1x) and IsPrime(p1) and IsPrime(p1x) and p1<=stop:  Prime.append(p1)
        if not(p2 == p2x) and IsPrime(p2) and IsPrime(p2x) and p2<=stop:  Prime.append(p2)
        k = k + 1   
    return Prime
            
#Test de primalidad de Miller-Rabin
def TryComposite(a, d, n, s):
    if pow(a, d, n) == 1: return False
    for i in range(s): 
        if pow(a, 2**i * d, n) == n-1: return False
    return True # n  is definitely composite
   
def IsPrime(n, PrecisionForHugeN=16):
    if n in KnownPrimes or n in (0, 1): return True
    if any((n % p) == 0 for p in KnownPrimes): return False
    
    d, s = n - 1, 0
    while not d % 2: d, s = d >> 1, s + 1
    # Returns exact according to http://primes.utm.edu/prove/prove2_3.html
    if n < 1373653:         return not any(TryComposite(a, d, n, s) for a in (2, 3))
    if n < 25326001:        return not any(TryComposite(a, d, n, s) for a in (2, 3, 5))
    if n < 118670087467:    return [not any(TryComposite(a, d, n, s) for a in (2, 3, 5, 7)),False][n == 3215031751]
    if n < 2152302898747:   return not any(TryComposite(a, d, n, s) for a in (2, 3, 5, 7, 11))
    if n < 3474749660383:   return not any(TryComposite(a, d, n, s) for a in (2, 3, 5, 7, 11, 13))
    if n < 341550071728321: return not any(TryComposite(a, d, n, s) for a in (2, 3, 5, 7, 11, 13, 17))
    # otherwise
    return not any(TryComposite(a, d, n, s) for a in KnownPrimes[:PrecisionForHugeN])



import math
def isPrime(n):
    checkNum = int(math.sqrt(n))
    for i in range(1,checkNum+1):
        if n%i == 0 and i != 1:
            return False
    return True
def backwardsPrime(start, stop):
    backwardsPrimes = []
    
    for i in range(start,stop+1):
        if isPrime(i) == True:
            reversedPrime = int(str(i)[::-1])
            if isPrime(reversedPrime) and reversedPrime != i:
                backwardsPrimes.append(i)
    return backwardsPrimes

def backwardsPrime(start, stop):
    output = []
    for x in range(start,stop+1):
        if isPrime(x):
            if isReversePrime(x):
                output.append(x)
    return output
def isPrime(input):
    if input % 2 == 0: return False
    for x in range(3, int(input**0.5) + 1, 2):
        if input % x == 0: return False
    else:
        return True
def isReversePrime(input):
    tempstr = ""
    iptemp = str(input)
    i = (len(iptemp) - 1)
    while(i >= 0):
        tempstr += iptemp[i]
        i = i -1
    temp = 0
    temp = int(tempstr)
    if input == temp: return False
    if isPrime(temp): return True
    else: return False