6 kyu
Sum of Digits / Digital Root
94,419 of 290,017user578387
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 | 517619 |
Total Skips | 48439 |
Total Code Submissions | 1045670 |
Total Times Completed | 290017 |
Ruby Completions | 7938 |
JavaScript Completions | 94419 |
CoffeeScript Completions | 216 |
Python Completions | 102715 |
Clojure Completions | 767 |
Haskell Completions | 2334 |
Java Completions | 31575 |
C# Completions | 17693 |
Swift Completions | 2141 |
R Completions | 503 |
C Completions | 6741 |
C++ Completions | 14607 |
Scala Completions | 805 |
NASM Completions | 89 |
Go Completions | 4158 |
OCaml Completions | 188 |
TypeScript Completions | 6466 |
Julia Completions | 191 |
Prolog Completions | 62 |
Nim Completions | 90 |
Elixir Completions | 350 |
Crystal Completions | 49 |
Factor Completions | 30 |
Elm Completions | 70 |
Rust Completions | 2583 |
Pascal Completions | 72 |
F# Completions | 141 |
COBOL Completions | 36 |
D Completions | 25 |
PHP Completions | 1548 |
Groovy Completions | 14 |
Dart Completions | 146 |
Lua Completions | 29 |
Total Stars | 4701 |
% of votes with a positive feedback rating | 90% of 24982 |
Total "Very Satisfied" Votes | 20490 |
Total "Somewhat Satisfied" Votes | 4127 |
Total "Not Satisfied" Votes | 365 |