fork download
  1. -module(prog).
  2. -export([main/0]).
  3.  
  4. pyth(N) ->
  5. L = [{A, B, C} ||
  6. A <- lists:seq(1, N - 2),
  7. B <- lists:seq(A + 1, N - 1),
  8. C <- lists:seq(B + 1, N),
  9. A + B + C =< N,
  10. A * A + B * B == C * C],
  11. io:format("~p\n", [L]).
  12.  
  13. main() ->
  14. pyth(100).
Success #stdin #stdout 0.29s 8448KB
stdin
Standard input is empty
stdout
[{3,4,5},
 {5,12,13},
 {6,8,10},
 {7,24,25},
 {8,15,17},
 {9,12,15},
 {9,40,41},
 {10,24,26},
 {12,16,20},
 {12,35,37},
 {15,20,25},
 {15,36,39},
 {16,30,34},
 {18,24,30},
 {20,21,29},
 {21,28,35},
 {24,32,40}]