#! /usr/bin/env python3 """ pe15.py https://mind.kittttttan.info/py/pe15 """ # https://mind.kittttttan.info/py/pe0 from pe import perm, fact def pe15(m=20, n=20): """ Starting in the top left corner in a 20 by 20 grid, how many routes are there to the bottom right corner? """ # return fact(m + n) // (fact(m) * fact(n)) p = perm(m + n, m) f = fact(n) print("%d / %d = %d" % (p, f, p // f)) if __name__ == "__main__": pe15()