Jacobsthal numbers: Difference between revisions

m
→‎{{header|Haskell}}: Adjusted a type
m (→‎{{header|Haskell}}: Adjusted a type)
Line 841:
 
jacobsthal :: [Integer]
jacobsthal = jacobsthalish [(0, 1])
 
jacobsthalish :: [(Integer], Integer) -> [Integer]
jacobsthalish (x, y) = unfoldr go [x, y]
where
go [] = Nothing
go [_] = Nothing
go (a : b : xs) = Just (a, b : xs <> [2 * a + b])
 
Line 861 ⟶ 859:
( "Jacobsthal-Lucas numbers",
30,
jacobsthalish [(2, 1])
),
( "Jacobsthal oblong numbers",
9,655

edits