Jump to content

Law of cosines - triples: Difference between revisions

m
Line 265:
-> [(Int, Int, Int)]
triangles f n =
let mapRoots ::= Map.MapfromList Int$ ((,) =<< (^ 2)) <$> [1 .. Intn]
mapRoots = Map.fromList $ ((,) =<< (^ 2)) <$> [1 .. n]
in Set.elems $
foldr
Line 273 ⟶ 272:
Just c -> Set.insert (a, b, c) triSet
_ -> triSet))
(Set.fromList [] :: Set.Set (Int, Int, Int))
([1 .. n] >>=
(\a -> (flip (,,) a =<< (a * a +) . (>>= id) (*)) <$> [1 .. a]))
 
 
-- TESTS ------------------------------------------------------------------------
 
f90, f60, f60ne, f120 :: Map.Map Int Int -> Int -> Int -> Int -> Int -> Maybe Int
f90 dct x2 ab a b = Map.lookup x2 dct
9,659

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.