Skip to content

Instantly share code, notes, and snippets.

@TakashiHarada
Created March 14, 2018 03:37
Show Gist options
  • Save TakashiHarada/312c65333110de6c3cb44c1c30927a5d to your computer and use it in GitHub Desktop.
Save TakashiHarada/312c65333110de6c3cb44c1c30927a5d to your computer and use it in GitHub Desktop.
fact :: Integer -> Integer
fact n = product [1..n]
comb :: Integer -> Integer -> Integer
comb n k = product [(n-k+1)..n] `div` (fact k)
f :: Integer -> Integer
f w = sum [(comb (3^w) k) * (fact k) * 2^k | k <- [1..3^w]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment