1. dafis
  2. arithmoi

Commits

dafis  committed f73cb03

Warning police

  • Participants
  • Parent commits 7462b89
  • Branches default

Comments (0)

Files changed (2)

File Math/NumberTheory/Moduli.hs

View file
 import Data.Array.Unboxed
 import Data.Array.Base (unsafeAt)
 import Data.Maybe (fromJust)
-import Data.List (foldl', nub)
+import Data.List (nub)
 import Control.Monad (foldM, liftM2)
 
 import Math.NumberTheory.Utils (shiftToOddCount, splitOff)
         (k,s) = shiftToOddCount n'
         k2 = k `quot` 2
         e2 = e-k
-        solve r 1 = Just 1
+        solve _ 1 = Just 1
         solve 1 _ = Just 1
         solve r p
             | rem4 r == 3   = Nothing  -- otherwise r ≡ 1 (mod 4)
     = case sqM2P n expo of
         Just r -> let m = 1 `shiftL` (expo-1)
                   in nub [r, (r+m) `mod` (2*m), (m-r) `mod` (2*m), 2*m-r]
+        _ -> []
 sqrtModPPList n pe@(prime,expo)
     = case sqrtModPP n pe of
         Just 0 -> [0]
             | jacobi' p n == -1 = p
             | otherwise         = search ps
         search _ = error "Should never have happened, prime list exhausted."
-
-modProd :: [Integer] -> Integer -> Integer
-modProd fs md = foldl' (\a b -> (a*b) `mod` md) 1 fs

File Math/NumberTheory/Primes/Sieve/Eratosthenes.hs

View file
 --
 {-# LANGUAGE CPP, BangPatterns #-}
 #if __GLASGOW_HASKELL__ >= 700
-{-# OPTIONS_GHC -fspec-constr-count=6 #-}
+{-# OPTIONS_GHC -fspec-constr-count=8 #-}
 #endif
 {-# OPTIONS_HADDOCK hide #-}
 module Math.NumberTheory.Primes.Sieve.Eratosthenes