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

Stats:

CreatedSep 19, 2014
PublishedSep 19, 2014
Warriors Trained517619
Total Skips48439
Total Code Submissions1045670
Total Times Completed290017
Ruby Completions7938
JavaScript Completions94419
CoffeeScript Completions216
Python Completions102715
Clojure Completions767
Haskell Completions2334
Java Completions31575
C# Completions17693
Swift Completions2141
R Completions503
C Completions6741
C++ Completions14607
Scala Completions805
NASM Completions89
Go Completions4158
OCaml Completions188
TypeScript Completions6466
Julia Completions191
Prolog Completions62
Nim Completions90
Elixir Completions350
Crystal Completions49
Factor Completions30
Elm Completions70
Rust Completions2583
Pascal Completions72
F# Completions141
COBOL Completions36
D Completions25
PHP Completions1548
Groovy Completions14
Dart Completions146
Lua Completions29
Total Stars4701
% of votes with a positive feedback rating90% of 24982
Total "Very Satisfied" Votes20490
Total "Somewhat Satisfied" Votes4127
Total "Not Satisfied" Votes365
Ad
Contributors
  • user578387 Avatar
  • jhoffner Avatar
  • hbakhtiyor Avatar
  • xcthulhu Avatar
  • Unnamed Avatar
  • anter69 Avatar
  • Chrono79 Avatar
  • naithar Avatar
  • imjasonmiller Avatar
  • kleidemos Avatar
  • docgunthrop Avatar
  • B1ts Avatar
  • Blind4Basics Avatar
  • Firefly2002 Avatar
  • acjoker Avatar
  • robbieaverill Avatar
  • Voile Avatar
  • Madjosz Avatar
  • kroppt Avatar
  • mentalplex Avatar
  • giannismach Avatar
  • monadius Avatar
  • hobovsky Avatar
  • ___i Avatar
  • __Anonymous__ Avatar
  • uniapi Avatar
  • xavierguihot Avatar
  • stellartux Avatar
  • user8436785 Avatar
  • Knaque Avatar
  • ejini战神 Avatar
  • user2058606 Avatar
  • nhals Avatar
  • akar-0 Avatar
  • LearningFTW Avatar
  • c0deMaster Avatar
  • FranzMartyn Avatar
  • anudeep7150 Avatar
  • egen34 Avatar
  • 4500zenja1 Avatar
  • Shuwiku Avatar
  • premek Avatar
Ad