Advertisement
Vladi1442

Untitled

Aug 10th, 2022
437
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. mySumRecPM :: [Int] -> Int
  3. mySumRecPM [] = 0
  4. mySumRecPM (x:xs) = x + mySumRecPM xs
  5.  
  6. primesInRangesLC :: Int -> Int -> [Int]
  7. primesInRangesLC x y = [d | d <- [min x y .. max x y], isPrime d && d >= 3]
  8.  
  9. primesInRangesHOF :: Int -> Int -> [Int]
  10. primesInRangesHOF x y = filter (\d -> isPrime d && d >= 3) [min x y .. max x y]
  11.  
  12. sumUnevenLC :: Int -> Int -> Int
  13. sumUnevenLC x y = sum [d | d <- [x..y], mod d 2 /= 0]
  14.  
  15. isAscending :: Int -> Bool
  16. isAscending n = n < 10 || mod n 10 >= mod (div n 10) 10 && isAscending (div n 10)
  17.  
  18. sumSpecialPrimes :: Int -> Int -> Int
  19. sumSpecialPrimes n d = sum $ take n $ filter (\x -> isPrime x && elem (intToDigit n) (show x)) [1..]
  20.  
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement