Euler Problem 49
================

The arithmetic sequence, 1487, 4817, 8147, in which each of the terms increases by 3330, is unusual in two ways: 
    - each of the three terms are prime, and,
    - each of the 4-digit numbers are permutations of one another.

There are no arithmetic sequences made up of three 1-, 2-, or 3-digit primes, exhibiting this property, but there is one other 4-digit increasing sequence.

What 12-digit number do you form by concatenating the three terms in this sequence?


```python
from sympy import isprime
from collections import defaultdict
from itertools import combinations

primes = defaultdict(list)
for n in range(1001, 10000, 2):
    if isprime(n):
        key = ''.join(sorted(str(n)))
        primes[key].append(n)
for key in primes:
    for p, q in combinations(primes[key], 2):
        r = q + (q - p)
        if r in primes[key]:
            print(f'{p}{q}{r}')
            break
```

    148748178147
    296962999629



```python

```

6b57d107e5e6ae783d09e87e9f5cb327b45832fb
ipynb
Jupyter Notebook
Euler 049 - Prime permutations.ipynb
Radcliffe/project-euler
5eb0c56e2bd523f3dc5329adb2fbbaf657e7fa38
MIT
2016-05-11T18:55:35.000Z
2019-12-27T21:38:43.000Z
Euler 049 - Prime permutations.ipynb
Radcliffe/project-euler
5eb0c56e2bd523f3dc5329adb2fbbaf657e7fa38
MIT
Euler 049 - Prime permutations.ipynb
Radcliffe/project-euler
5eb0c56e2bd523f3dc5329adb2fbbaf657e7fa38
MIT
Qwen/Qwen-72B
1. YES
2. YES