Created
February 29, 2016 10:17
-
-
Save goodwin64/04136e006cd3202b3a97 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Goldbach's conjecture is one of the oldest and best-known unsolved problems in number theory and all of mathematics. It states: | |
Every even integer greater than 2 can be expressed as the sum of two primes. | |
For example: | |
`6 = 3 + 3`</br> | |
`8 = 3 + 5`</br> | |
`10 = 3 + 7 = 5 + 5`</br> | |
`12 = 5 + 7` | |
Some rules for the conjecture: | |
- pairs should be descending like [3,5] not [5,3] | |
- all pairs should be in ascending order based on the first element of the pair: | |
`[[5, 13], [7, 11]]` is accepted </br> | |
but `[[7, 11],[5, 13]]` is not accepted. | |
Write the a function that find all identical pairs of prime numbers: | |
```python | |
def goldbach(even_number) | |
``` | |
You should return an array of containing pairs of primes, like: | |
```python | |
[[5, 13], [7, 11]] # even_number = 18 | |
``` | |
or | |
```python | |
[[3, 31], [5, 29], [11, 23], [17, 17]] # even_number = 34 | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment