## Adding Digits

#### Problem

Imagine writing down every possible combination of the digits 1, 2, 3, and 4. What would be the sum of all these combinations?

For example, with the digits 1, 2 and 3; there are six combinations and the sum of these combinations is

123 + 132 + 213 + 231 + 312 + 321 = 1332.

#### Solution

Considering combinations,

1234 | Each digit appears in each column 6 times. |

1243 | So each column must add up to, |

1324 | 6(1 + 2 + 3 + 4) = 60. |

1342 | |

1423 | Total = 60(1 + 10 + 100 + 100) = 66660. |

1432 | |

2134 , etc. |

What about the digits 1, 2, 3, ..., `n` ?

Problem ID: 109 (Mar 2003) Difficulty: 2 Star