project_euler.problem_111.sol1 ============================== .. py:module:: project_euler.problem_111.sol1 .. autoapi-nested-parse:: Project Euler Problem 111: https://projecteuler.net/problem=111 Primes with Runs First, note that for sequence of 10 digits, M(4,d) is 8 or 9. Start by constructing prime list up to sqrt(n), which are used to check if number is prime. Then iterate over possible combinations of numbers checking each if prime. Functions --------- .. autoapisummary:: project_euler.problem_111.sol1.generate_primes project_euler.problem_111.sol1.is_prime project_euler.problem_111.sol1.solution Module Contents --------------- .. py:function:: generate_primes(n: int) Calculates the list of primes up to and including n. >>> generate_primes(6) [2, 3, 5] .. py:function:: is_prime(n, primes_all) Check in int n is prime using primes_all list of relatively small primes compared to n. >>> is_prime(5, [2, 3]) True .. py:function:: solution(n: int = 10000000000) -> int Check each possible combination if it is prime. >>> solution(10000) 273700