_Based on [Project Euler problem 35](https://projecteuler.net/problem=35)_

A circular prime is a prime in which every circular permutation of that number is also prime. Circular permutations are created by rotating the digits of the number, for example: `197, 971, 719`. One-digit primes are circular primes by definition.

Complete the function that dertermines if a number is a circular prime.

There are 100 random tests for numbers up to 10000.

Difficulty: introductory

Starter code:

def circular_prime(n):
	

Solutions:
def circular_permutations(n):
    n = str(n)
    return [int(n[i:] + n[:i]) for i in range(len(n))]

def is_prime(n):
    return n > 1 and all(n % i != 0 for i in range(2, int(n**0.5)+1))

def circular_prime(n):
    return all(is_prime(x) for x in circular_permutations(n))


def circular_prime(n):
    return n in [2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73, 79, 97, 113, 131, 197, 199, 311, 337, 373, 719, 733, 919, 971, 991, 1193, 1931, 3119, 3779, 7793, 7937, 9311, 9377, 11939]

def circular_prime(n):
    ns = str(n)
    lp = []
    for i in ns:
        ns = ns[1:] + ns[0]
        lp.append(ns)
    for i in lp:
        for j in range(2,int(i)):
            if int(i)%j == 0:
                return False
    return True and n != 1


from collections import deque

def is_prime(n):
   return n > 1 and all(n % i != 0 for i in range(2, int(n**0.5) + 1))
   
def circular_prime(n):
    items = deque(str(n))
    for _ in range(len(items)):
        items.rotate(1)
        if not is_prime(int("".join(items))):
            return False
    return True

def circular_permutations(n):
    s = str(n)
    return [int(s[i:] + s[:i]) for i in range(len(s))]

def is_prime(n):
    return n == 2 or pow(2, n - 1, n) == 1

def circular_prime(n):
    return all(is_prime(c) for c in circular_permutations(n))

def is_prime(n):
    d = 2
    while d * d <= n:
        if n % d == 0:
            return False
        d += 1
    return n > 1

def rotate(l, n):
    return l[-n:] + l[:-n]

def circular_prime(number):
    
    number_list = [int(x) for x in str(number)]
    if is_prime(number):
        check_list = [True]
        for index in range(1,len(number_list)):
            number_rotated = rotate(number_list,index)
            number_join = int(''.join(map(str, number_rotated)))
            if is_prime(number_join):
                check_list.append(True)
        if (len(check_list) == len(number_list)): return True
        else: return False
    else: return False
    
    


def circular_prime(n):
    #test is a number is a circular prime
    # uses 2 functions
   
    l=len(str(n)) # the length of the number  
    
    for i in range (l):
        
        if is_prime(n):  
            n=circul_num(n,l)
        else: # the num is not prime 
            return False # return False
    return True

def circul_num(n,l):
    # one  circular permutation of a num to left 
    # input n: int number , l: length of number
    power =10**(l-1)    # poer of 10 to cut the number at highst digit

    if len(str(n))<l:   #if num is short, need a 0 at the end to compensate
        N=n*10        
    else: 
        N=(n%power)*10+(n//power) # permutation to the left
    return N

def is_prime(n):
    # chek if a number is praime
    if n==1:
        return False 

    for i in range(2,int(n**0.5)+1): #runs from 2 to the sqrt of n
        if n%i==0: 
            return False 
        
    return True


circular_prime = {2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73, 79, 97, 113, 131, 197, 199, 311, 337, 373, 719,
                  733, 919, 971, 991, 1193, 1931, 3119, 3779, 7793, 7937, 9311, 9377, 11939}.__contains__