# DataWeave programming challenge #8: Sum all digits to get a 1-digit number

> Repeatedly sum the digits of a set of numbers in DataWeave until a single-digit result remains (the digital root). Clues and full solutions are in the companion article.

- **Watch:** https://www.youtube.com/watch?v=4BThMEAJ02s
- **Page:** https://prostdev.com/video/dataweave-challenge-8-sum-digits-one-digit
- **Series:** DataWeave Challenges

## About this video

Repeatedly sum the digits of a set of numbers in DataWeave until a single-digit result remains (the digital root). Clues and full solutions are in the companion article.

## Resources

- [Read the article](https://www.prostdev.com/post/dataweave-programming-challenge-8)
- [Solve on the Playground](https://dataweave.mulesoft.com/learn/playground?projectMethod=GHRepo&repo=alexandramartinez%2Fdataweave-challenges&path=challenges%2F8)

## Transcript

### Intro

Hi everyone, Alex here. In this DataWeave challenge we are going to take all of the digits from any numbers, and we are going to keep summing up these digits until we get to just a one-digit number. Let me demonstrate.

### The challenge

Here is a problem that we have: we have several numbers here, we are going to sum them all, and then keep summing each digit until we end up with just one digit. In this case it's going to be 2.

Let me give you another example. In this case we have 1 and 2, so if we sum 1 and 2 we end up with 3. Or in this case we have first 1, 2, 3 and then 4, 5, 6, and we end up with 3 — we can either do 123 plus 456 like this, 123 + 456, we end up with 579, so now we do 5 + 7 + 9, we end up with 21, and now 2 + 1, we end up with 3. Or another way to see it is 1 + 2 + 3 + 4 + 5 + 6, we end up with 21, so 2 + 1, we end up with 3.

### Wrap-up

That's all. I hope you like this challenge, it was very fun to do, and I will see you then in a different video. Bye!