6 kyu
Sum of Digits / Digital Root
7,944 of 290,758user578387
Description:
Digital root is the recursive sum of all the digits in a number.
Given n
, take the sum of the digits of n
. If that value has more than one digit, continue reducing in this way until a single-digit number is produced. The input will be a non-negative integer.
Examples
16 --> 1 + 6 = 7
942 --> 9 + 4 + 2 = 15 --> 1 + 5 = 6
132189 --> 1 + 3 + 2 + 1 + 8 + 9 = 24 --> 2 + 4 = 6
493193 --> 4 + 9 + 3 + 1 + 9 + 3 = 29 --> 2 + 9 = 11 --> 1 + 1 = 2
Mathematics
Algorithms
Similar Kata:
Stats:
Created | Sep 19, 2014 |
Published | Sep 19, 2014 |
Warriors Trained | 518800 |
Total Skips | 48512 |
Total Code Submissions | 1047443 |
Total Times Completed | 290758 |
Ruby Completions | 7944 |
JavaScript Completions | 94611 |
CoffeeScript Completions | 217 |
Python Completions | 103026 |
Clojure Completions | 768 |
Haskell Completions | 2335 |
Java Completions | 31658 |
C# Completions | 17736 |
Swift Completions | 2142 |
R Completions | 505 |
C Completions | 6760 |
C++ Completions | 14650 |
Scala Completions | 805 |
NASM Completions | 89 |
Go Completions | 4170 |
OCaml Completions | 188 |
TypeScript Completions | 6504 |
Julia Completions | 191 |
Prolog Completions | 62 |
Nim Completions | 90 |
Elixir Completions | 350 |
Crystal Completions | 50 |
Factor Completions | 30 |
Elm Completions | 70 |
Rust Completions | 2588 |
Pascal Completions | 72 |
F# Completions | 141 |
COBOL Completions | 36 |
D Completions | 25 |
PHP Completions | 1556 |
Groovy Completions | 14 |
Dart Completions | 152 |
Lua Completions | 29 |
Total Stars | 4712 |
% of votes with a positive feedback rating | 90% of 25016 |
Total "Very Satisfied" Votes | 20523 |
Total "Somewhat Satisfied" Votes | 4128 |
Total "Not Satisfied" Votes | 365 |