let rec distant_roots num_roots roots_so_far d =
    let distance_from_current x =
      float_list_sum (map (fun y -> distance (fst x) (fst y)) roots_so_far) in
    if num_roots <= 0
    then (roots_so_far, d)
    else match select (order_by_desc distance_from_current) 1 d with
        | ([p], rem) ->
            let r1 = p :: roots_so_far in
            let (roots, points) = distant_roots (num_roots - 1) r1 rem in
            (r1, rem)
        | (_, rem) -> (roots_so_far, rem)