<commit_before>WITH primes AS (
  SELECT n 
  FROM generate_series(3,(|/600851475143)::integer, 2) i(n)
  WHERE NOT EXISTS(
    SELECT 1 
    FROM generate_series(2,(|/n)::integer) ints(i)
    WHERE n % i = 0
  )
)

SELECT max(n)
FROM primes
WHERE 600851475143 % n = 0
  AND n < (|/600851475143) 
;<commit_msg>Way faster problem_3.sql<commit_after>\timing
with primes AS (
  select n
  from generate_series(3,(|/600851475143)::integer, 2) gs(n)
  where not exists (
    select 1
    from generate_series(2,(|/gs.n)::integer) ints(i)
    where n % i = 0
  )
  AND 600851475143 % gs.n = 0
)

select max(n) from primes;
{'fraction_non_alphanumeric': 0.13474025974025974, 'fraction_numerical': 0.1185064935064935, 'mean_word_length': 3.471014492753623, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 3, '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}}
{'dir': 'git-commits-cleaned', 'id': '233740', 'n_tokens_mistral': 305, 'n_tokens_neox': 247, 'n_words': 64}