data/problems/159.yml
---
:id: 159
:name: Digital root sums of factorisations
:url: https://projecteuler.net/problem=159
:content: "A composite number can be factored many different ways. For instance, not
including multiplication by one, 24 can be factored in 7 distinct ways:\n\n24 =
2x2x2x3 \n24 = 2x3x4 \n24 = 2x2x6 \n24 = 4x6 \n24 = 3x8 \n24 = 2x12 \n24 =
24\n\nRecall that the digital root of a number, in base 10, is found by adding together
the digits of that number, and repeating that process until a number is arrived
at that is less than 10. Thus the digital root of 467 is 8.\n\nWe shall call a Digital
Root Sum (DRS) the sum of the digital roots of the individual factors of our number.
\ \n The chart below demonstrates all of the DRS values for 24.\n\n| Factorisation
| Digital Root Sum |\n| --- | --- |\n| \n2x2x2x3\n | \n9\n |\n| \n2x3x4\n | \n9\n
|\n| \n2x2x6\n | \n10\n |\n| \n4x6\n | \n10\n |\n| \n3x8\n | \n11\n |\n| \n2x12\n
| \n5\n |\n| \n24\n | \n6\n |\n\nThe maximum Digital Root Sum of 24 is 11. \nThe
function mdrs(<var>n</var>) gives the maximum Digital Root Sum of <var>n</var>.
So mdrs(24)=11. \nFind ∑mdrs(<var>n</var>) for 1 \\< <var>n</var> \\< 1,000,000.\n\n"