Sha256: aa614800468172d94e1340e24b725918acece22bdb7faef0d61792c45b6c66ef
Contents?: true
Size: 1.01 KB
Versions: 327
Compression:
Stored size: 1.01 KB
Contents
defmodule Triplet do @doc """ Calculates sum of a given triplet of integers. """ @spec sum([non_neg_integer]) :: non_neg_integer def sum(triplet) do end @doc """ Calculates product of a given triplet of integers. """ @spec product([non_neg_integer]) :: non_neg_integer def product(triplet) do end @doc """ Determines if a given triplet is pythagorean. That is, do the squares of a and b add up to the square of c? """ @spec pythagorean?([non_neg_integer]) :: boolean def pythagorean?([a, b, c]) do end @doc """ Generates a list of pythagorean triplets from a given min (or 1 if no min) to a given max. """ @spec generate(non_neg_integer, non_neg_integer) :: [list(non_neg_integer)] def generate(min, max) do end @doc """ Generates a list of pythagorean triplets from a given min to a given max, whose values add up to a given sum. """ @spec generate(non_neg_integer, non_neg_integer, non_neg_integer) :: [list(non_neg_integer)] def generate(min, max, sum) do end end
Version data entries
327 entries across 327 versions & 1 rubygems