solve limit = solve' triangles
  where
    solve' ts
      | n >= limit = (limit,n,t,p,d)
      | otherwise = solve' (tail ts)
      where
        t = head ts
        p = primeFactors t
        d = divisors p
        n = length d
solve limit = solve' triangles
  where
    solve' ts
      | n >= limit = (limit,n,t,p,d)
      | otherwise = solve' (tail ts)
      where
        t = head ts
        p = primeFactors t
        d = divisors p
        n = length d
solve limit = solve' triangles
  where
    solve' ts
      | n >= limit = (limit,n,t,p,d)
      | otherwise = solve' (tail ts)
      where
        t = head ts
        p = primeFactors t
        d = divisors p
        n = length d