Created
February 6, 2018 21:45
-
-
Save AnthonyMikh/d694ad13c738ce4dd3984db10a7e9517 to your computer and use it in GitHub Desktop.
Решение задачи №68 от UniLecs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fibs = 1 : 1 : zipWith (+) fibs (tail fibs) | |
fibs2 = map (*2) fibs | |
solution n = fibs2 !! n | |
main = print $ solution 8 | |
-- > 68 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Функция
fibs
возвращает бесконечный список чисел Фибоначчи. Функцияfibs2
возвращает бесконечный список удвоенных чисел Фибоначчи. Оператор индексации!!
возвращаетn+1
элемент списка (т. к. индекс начинается с нуля).