Jacobsthal numbers: Difference between revisions
Content added Content deleted
Line 1,322: | Line 1,322: | ||
# jacobsthalish :: (Int, Int) -> [Int] |
# jacobsthalish :: (Int, Int) -> [Int] |
||
def jacobsthalish( |
def jacobsthalish(xy): |
||
'''Infinite sequence of jacobsthal-type series |
'''Infinite sequence of jacobsthal-type series |
||
beginning with a, b |
beginning with a, b |
||
''' |
''' |
||
def go( |
def go(ab): |
||
a, |
a, b = ab |
||
return a, |
return a, [b, 2 * a + b] |
||
return unfoldr(go)( |
return unfoldr(go)(xy) |
||