// See http://www.itmn.biz/
//      > ３×３魔方陣　問題
//     http://www.ne.jp/asahi/suzuki/hp/houjin3.htm
//      > 魔方陣
//     http://www.grogono.com/magic/makeyourown4.php
//     > Make Your Own 4x4 Magic Square
//     http://quasistoic.org/fun/magicsquare/
//       > 4x4 Magic Square Solver
//     http://quasistoic.org/ts/archives/2006/08/13/magic-square-solver/
//        > magic square generator

package perm
import scala.collection._

object Fact {
    val factsMem = List.range(0, 40).map(fact(_)).toArray

    private def fact(n:BigInt):BigInt = {
        if ((n == 0) || (n == 1)) 1
        else n * fact(n - 1)
    }

    def factMem(n:Int):BigInt = {
        factsMem(n)
    }
}
