7 kyu
Multiples and Digit Sums
1,022 of 1,661Spherixo
Description:
In this exercise, you will create a function that takes an integer, i
. With it you must do the following:
Find all of its multiples up to and including 100,
Then take the digit sum of each multiple (eg. 45 -> 4 + 5 = 9),
And finally, get the total sum of each new digit sum.
Note: If the digit sum of a number is more than 9 (eg. 99 -> 9 + 9 = 18) then you do NOT have to break it down further until it reaches one digit.
Example (if i
is 25):
Multiples of 25 up to 100 --> [25, 50, 75, 100]
Digit sum of each multiple --> [7, 5, 12, 1]
Sum of each new digit sum --> 25
If you can, try writing it in readable code.
Edit (3/17/2017): Added random tests
Algorithms
Similar Kata:
Stats:
Created | Mar 16, 2017 |
Published | Mar 16, 2017 |
Warriors Trained | 3054 |
Total Skips | 52 |
Total Code Submissions | 4572 |
Total Times Completed | 1661 |
Python Completions | 1022 |
Ruby Completions | 68 |
COBOL Completions | 7 |
JavaScript Completions | 618 |
Total Stars | 41 |
% of votes with a positive feedback rating | 92% of 297 |
Total "Very Satisfied" Votes | 257 |
Total "Somewhat Satisfied" Votes | 32 |
Total "Not Satisfied" Votes | 8 |
Total Rank Assessments | 13 |
Average Assessed Rank | 7 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 8 kyu |