Jacobi symbol: Difference between revisions

Content added Content deleted
Line 299: Line 299:
ys = [1,3 .. nth]
ys = [1,3 .. nth]
w = length (show nth)
w = length (show nth)
cols = [0 .. pred nCols]
rjust = justifyRight w ' ' . show
rjust = justifyRight w ' ' . show
showRow (x:xs) = unwords $ rjust x : "->" : map rjust xs
showRow (x:xs) = unwords $ rjust x : "->" : map rjust xs
cols = [0 .. pred nCols]
rowLines =
rowLines =
showRow <$>
showRow <$>
Line 310: Line 310:
(uncurry jacobi <$> ((<*>) . fmap (,)) cols [1,3 .. (nRows * 2)]))
(uncurry jacobi <$> ((<*>) . fmap (,)) cols [1,3 .. (nRows * 2)]))
in unlines $
in unlines $
(justifyRight w ' ' [] ++ " " ++ unwords (rjust <$> cols)) :
(justifyRight (4 + w) ' ' [] ++ unwords (rjust <$> cols)) :
replicate (length $ head rowLines) '-' : rowLines
replicate (length $ head rowLines) '-' : rowLines