project_euler.problem_077.sol1 ============================== .. py:module:: project_euler.problem_077.sol1 .. autoapi-nested-parse:: Project Euler Problem 77: https://projecteuler.net/problem=77 It is possible to write ten as the sum of primes in exactly five different ways: 7 + 3 5 + 5 5 + 3 + 2 3 + 3 + 2 + 2 2 + 2 + 2 + 2 + 2 What is the first value which can be written as the sum of primes in over five thousand different ways? Attributes ---------- .. autoapisummary:: project_euler.problem_077.sol1.NUM_PRIMES project_euler.problem_077.sol1.prime project_euler.problem_077.sol1.primes Functions --------- .. autoapisummary:: project_euler.problem_077.sol1.partition project_euler.problem_077.sol1.solution Module Contents --------------- .. py:function:: partition(number_to_partition: int) -> set[int] Return a set of integers corresponding to unique prime partitions of n. The unique prime partitions can be represented as unique prime decompositions, e.g. (7+3) <-> 7*3 = 12, (3+3+2+2) = 3*3*2*2 = 36 >>> partition(10) {32, 36, 21, 25, 30} >>> partition(15) {192, 160, 105, 44, 112, 243, 180, 150, 216, 26, 125, 126} >>> len(partition(20)) 26 .. py:function:: solution(number_unique_partitions: int = 5000) -> int | None Return the smallest integer that can be written as the sum of primes in over m unique ways. >>> solution(4) 10 >>> solution(500) 45 >>> solution(1000) 53 .. py:data:: NUM_PRIMES :value: 100 .. py:data:: prime :type: int .. py:data:: primes