open Batteries_uni
let get_list n r =
let process_coord (x,y) =
let fx,fy = (float x, float y) in
let base_angle = atan2 fy fx in
let delta_angle = r /. (sqrt (fx*.fx +. fy*.fy)) |> asin in
[(base_angle -. delta_angle, 1); (base_angle +. delta_angle, -1)] |> List.enum in
let coords_enum = [? (x, y) | x <- 0 -- n; y <- 0 -- x ; x *x + y*y < n * n; x * x + y * y>0 ?] in
let res = coords_enum |> Enum.map process_coord |> Enum.concat |> Array.of_enum in
Array.sort compare res;
res;;
let () = (get_list 10000 0.02) |> Array.length |> Printf.fprintf stdout "%d" ;;