##### 问题描述投票：0回答：2

``````elem' n xs = case drop (4*n) xs of
(y:ys) -> y : elem' n ys
[] -> []
``````

##### 2个回答
0

``[1, 5 .. ]``

``````Prelude> [1, 5 .. ]
[1,5,9,13,17,21,25,29,33,37,41,45,49,53,57,61,65,69,73,77,81,85,89,93,97,101,105,109,113,117,121,125,129,133,137,141,145,149,153,157,161,165,169,173,177,…``````

``````obtain4_1 :: [a] -> [a]
obtain4_1 [] = []
obtain4_1 (x:xs) = x : go xs
where go (_:_:_:ys) = obtain4_1 ys
go _ = []``````

``````Prelude> obtain4_1 [1..]
[1,5,9,13,17,21,25,29,33,37,41,45,49,53,57,61,65,69,73,77,81,85,89,93,97,101,105,109,113,117,121,125,129,133,137,141,145,149,153,157,161,165,169,173,177,181,…``````

0

``````obtain :: Int -> Int -> [Int]
obtain 0 _  = []
obtain n x = [ a * x + 1| a<-[0..n] ]
``````

``````*Main> obtain 10 4
[1,5,9,13,17,21,25,29,33,37,41]
*Main> obtain 10 3
[1,4,7,10,13,16,19,22,25,28,31]
*Main> obtain 10 2
[1,3,5,7,9,11,13,15,17,19,21]
*Main> obtain 15 2
[1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31]
*Main> obtain 5 1
[1,2,3,4,5,6]
``````