Haskell
primeBetween :: Int-> Int -> [Int]
-- Outputs all the prime numbers between the two inputs. --
-- Pre: int > 0 --
primeBetween int1 int2
| int1 == int2 = [ x | x <- [int1], isPrime x ]
| int1 < int2 = [ x | x <- [int1..int2], isPrime x ]
| int2 < int1 = [ x | x <- [int2..int1], isPrime x ]
isPrime :: Int -> Bool
-- Outputs True if Input is Prime, False Otherwise. --
-- Pre: int > 1 --
isPrime int
| int < 2 = False
| otherwise = findPrime 2
where
findPrime :: Int -> Bool
findPrime n
| fromIntegral n > sqrt (fromIntegral int) = True
| int `mod` n == 0 = False
| otherwise = findPrime (n + 1)