<jupyter_start><jupyter_text>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?<jupyter_code>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<jupyter_output>148748178147
296962999629
{'fraction_non_alphanumeric': 0.10010111223458039, 'fraction_numerical': 0.06066734074823053, 'mean_word_length': 3.6261682242990654, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '358124', 'license': 'MIT', 'n_tokens_mistral': 350, 'n_tokens_neox': 291, 'n_words': 122, 'path': 'Euler 049 - Prime permutations.ipynb', 'repo_name': 'Radcliffe/project-euler', 'size': '989'}