coded permuation func, need to check func and fix recur func
added permutation func, changed recur. func