from typing import List


from ..library.sqrt import fsqrt
from ..library.number_theory.primes import is_prime, prime_sieve


def is_circular_prime(n: int, sieve: List[int]) -> bool:
    for i in range(len(str(n))):
        if not is_prime(int(str(n)[i:] + str(n)[:i]), sieve):
            return False

    print(n)

    return True


def solve(digits: int=6) -> int:
    bound = 10 ** digits
    sieve = prime_sieve(fsqrt(bound))

    return sum(1 for prime in range(bound) if is_circular_prime(prime, sieve))

from typing import List

from ..library.base import number_to_list, list_to_number
from ..library.sqrt import fsqrt
from ..library.number_theory.primes import is_prime, prime_sieve


def is_circular_prime(n: int, sieve: List[int]) -> bool:
    rep_n = number_to_list(n)

    for i in range(len(rep_n)):
        if not is_prime(list_to_number(rep_n[i:] + rep_n[:i]), sieve):
            return False

    print(n)

    return True


def solve(digits: int=6) -> int:
    bound = 10 ** digits
    sieve = prime_sieve(fsqrt(bound))

    return sum(1 for prime in range(1, bound)
               if is_circular_prime(prime, sieve))

Make 35 use number_to_list and inverse
Make 35 use number_to_list and inverse

  from typing import List
  
- 
+ from ..library.base import number_to_list, list_to_number
  from ..library.sqrt import fsqrt
  from ..library.number_theory.primes import is_prime, prime_sieve
  
  
  def is_circular_prime(n: int, sieve: List[int]) -> bool:
+     rep_n = number_to_list(n)
+ 
-     for i in range(len(str(n))):
+     for i in range(len(rep_n)):
-         if not is_prime(int(str(n)[i:] + str(n)[:i]), sieve):
+         if not is_prime(list_to_number(rep_n[i:] + rep_n[:i]), sieve):
              return False
  
      print(n)
  
      return True
  
  
  def solve(digits: int=6) -> int:
      bound = 10 ** digits
      sieve = prime_sieve(fsqrt(bound))
  
-     return sum(1 for prime in range(bound) if is_circular_prime(prime, sieve))
+     return sum(1 for prime in range(1, bound)
+                if is_circular_prime(prime, sieve))
  
Make 35 use number_to_list and inverse
## Code Before:
from typing import List


from ..library.sqrt import fsqrt
from ..library.number_theory.primes import is_prime, prime_sieve


def is_circular_prime(n: int, sieve: List[int]) -> bool:
    for i in range(len(str(n))):
        if not is_prime(int(str(n)[i:] + str(n)[:i]), sieve):
            return False

    print(n)

    return True


def solve(digits: int=6) -> int:
    bound = 10 ** digits
    sieve = prime_sieve(fsqrt(bound))

    return sum(1 for prime in range(bound) if is_circular_prime(prime, sieve))

## Instruction:
Make 35 use number_to_list and inverse
## Code After:
from typing import List

from ..library.base import number_to_list, list_to_number
from ..library.sqrt import fsqrt
from ..library.number_theory.primes import is_prime, prime_sieve


def is_circular_prime(n: int, sieve: List[int]) -> bool:
    rep_n = number_to_list(n)

    for i in range(len(rep_n)):
        if not is_prime(list_to_number(rep_n[i:] + rep_n[:i]), sieve):
            return False

    print(n)

    return True


def solve(digits: int=6) -> int:
    bound = 10 ** digits
    sieve = prime_sieve(fsqrt(bound))

    return sum(1 for prime in range(1, bound)
               if is_circular_prime(prime, sieve))
