Advertisement
Guest User

Untitled

a guest
Oct 16th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
F# 0.54 KB | None | 0 0
  1. let test t =
  2.     let a,b,c = t
  3.     (a < b) && (b < c) && (a + b + c = 1000) && (a * a + b * b = c * c)
  4.  
  5. let generator t =
  6.     let x,y = t
  7.     let x2 = x * x
  8.     let y2 = y * y
  9.     let a = 2 * x * y
  10.     let b = x2 - y2
  11.     let c = x2 + y2
  12.     a,b,c
  13.    
  14. let c n =
  15.     [1..(n-1)]
  16.     |> List.chunkBySize 1
  17.     |> List.map (fun x -> n,(List.item 0 x))
  18.  
  19. let result =
  20.     [1..20]
  21.     |> List.map c
  22.     |> List.concat
  23.     |> List.map (fun x -> (
  24.         generator x
  25.     ))
  26.     |> List.filter (fun x -> (
  27.         test x
  28.     ))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement