Closed gregbo closed 5 years ago
def digit_product(s): return reduce(lambda x, y: x*y, map(int, [i for i in s]))
@gregbo But how many lines of algebra formulas do you need to write to justify that simplification?
I make a balance between computation time and human understanding. I believe my solution is the most appropriate for the small problem size.
Incidentally, the solution to Problem 6 can be further simplified as the product of linear terms and a constant:
n(n-1)(n+1)(3n+2)/12