Skip to content

Instantly share code, notes, and snippets.

@Camsbury
Created September 15, 2019 18:36
Show Gist options
  • Save Camsbury/97f749af36366065da8e0dfbf9611948 to your computer and use it in GitHub Desktop.
Save Camsbury/97f749af36366065da8e0dfbf9611948 to your computer and use it in GitHub Desktop.
(ns pentabonacci)
(defn count-odd-pentaFib [n]
(case n
0 0
1 1
2 1
3 1
4 1
(loop [n (- n 1) odds 1 a 1 b 1 c 2 d 4 e 8]
(case n
4 (+' odds (mod e 2))
(recur (- n 1) (+' odds (mod e 2)) b c d e (+' a b c d e))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment