blob: f51f207d0c4f8f36be95dd97fe56ac849a6460b4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
{-# LANGUAGE ParallelArrays #-}
{-# OPTIONS -fvectorise #-}
module SumNatsVect (sumNats) where
import Data.Array.Parallel.Prelude
import Data.Array.Parallel.Prelude.Int
import qualified Prelude as P
sumNats :: Int -> Int
sumNats maxN
= sumP [: x | x <- enumFromToP 0 (maxN - 1)
, (x `mod` 3 == 0) || (x `mod` 5 == 0) :]
|