### Problem 77: Prime summations

<p>It is possible to write ten as the sum of primes in exactly five different ways:</p>
<p class="margin_left">7 + 3<br />
5 + 5<br />
5 + 3 + 2<br />
3 + 3 + 2 + 2<br />
2 + 2 + 2 + 2 + 2</p>
<p>What is the first value which can be written as the sum of primes in over five thousand different ways?</p>



```python
from sympy import primefactors


def prime_summations(no_of_partitions):
    """
    Gives n such that the number of prime partitions
    of n is >= no_of_partitions

    n has a limit of 1000.
    i.e. no_of_partitions <= 10 quadrillion
    """
    l = [1, 0]
    for n in range(2, 1000):
        prime_partitions = sum([sum(primefactors(k))*l[n - k] for k in range(1, n + 1)])/n
        l.append(prime_partitions)
        if prime_partitions > no_of_partitions:
            return n, prime_partitions
            
print(prime_summations(5000))
```

    (71, 5007.0)



```python

```

9502f11a866944adb34f546855d81df4eefebbf2
ipynb
Jupyter Notebook
project_euler/python/077_prime_summations.ipynb
Sabihxh/secret
fb940df9af9c6d440150ffe43b80fcb49ff6c2b4
MIT
2018-03-20T12:04:06.000Z
2018-03-20T12:04:06.000Z
project_euler/python/077_prime_summations.ipynb
Sabihxh/secret
fb940df9af9c6d440150ffe43b80fcb49ff6c2b4
MIT
project_euler/python/077_prime_summations.ipynb
Sabihxh/secret
fb940df9af9c6d440150ffe43b80fcb49ff6c2b4
MIT
Qwen/Qwen-72B
1. YES
2. YES