def g2(n, m): if m <= 0: return n s = 0 for i in range(0, n * n, m): s += g2(n, m - 1) return s def f2(n): return g2(2 * n, 3)