<filename>dynamic_programming/ugly.py<gh_stars>1-10
def uglyrec(n, z):
    if n == 1:
        return z
    else:
        return min(uglyrec(n - 1, z * 2), uglyrec(n - 1, z * 3), uglyrec(n - 1, z * 5))


print(uglyrec(6, 1))

<filename>dynamic_programming/ugly.py<gh_stars>1-10
def uglyrec(n, z):
    if n == 1:
        return z
    else:
        return min(uglyrec(n - 1, z * 2), uglyrec(n - 1, z * 3), uglyrec(n - 1, z * 5))


print(uglyrec(6, 1))
