<jupyter_start><jupyter_text>Distinct primes factors The first two consecutive numbers to have two distinct prime factors are:14 = 2 × 715 = 3 × 5The first three consecutive numbers to have three distinct prime factors are:644 = 2² × 7 × 23645 = 3 × 5 × 43646 = 2 × 17 × 19.Find the first four consecutive integers to have four distinct prime factors each. What is the first of these numbers? ---  Idea Naive solution.Iterate through and check the number of distinct prime factors. ---<jupyter_code>from math import sqrt
from functools import reduce
from operator import mul
def get_prime_factors(n):
    factors = []
    d = 2
    while d <= sqrt(n):
        while n % d == 0:
            n //= d
            factors.append(d)
        d += 1
    if n != 1:
        factors.append(n)
    return factors
get_prime_factors(8)
get_prime_factors(12)
get_prime_factors(13)
get_prime_factors(644)
def solve(consecutive_number, distinct_prime_factors_number):
    first_number = reduce(mul, ([2, 3, 5, 7, 11])[:distinct_prime_factors_number], 1)
    while True:
        for i, n in enumerate(range(first_number, first_number+consecutive_number), 1):
            if len(set(get_prime_factors(n))) != distinct_prime_factors_number:
                first_number += i
                break
            if i == consecutive_number:
                return first_number
solve(2, 2)
solve(3, 3)
solve(4, 4)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08943661971830986, 'fraction_numerical': 0.03943661971830986, 'mean_word_length': 3.130813953488372, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 5, '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': '397255', 'license': 'MIT', 'n_tokens_mistral': 487, 'n_tokens_neox': 424, 'n_words': 154, 'path': '26-50/p47.ipynb', 'repo_name': 'Sorosliu1029/Euler', 'size': '1420'}