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

Stats:

CreatedMar 16, 2017
PublishedMar 16, 2017
Warriors Trained3054
Total Skips52
Total Code Submissions4572
Total Times Completed1661
Python Completions1022
Ruby Completions68
COBOL Completions7
JavaScript Completions618
Total Stars41
% of votes with a positive feedback rating92% of 297
Total "Very Satisfied" Votes257
Total "Somewhat Satisfied" Votes32
Total "Not Satisfied" Votes8
Total Rank Assessments13
Average Assessed Rank
7 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • Spherixo Avatar
  • tachyonlabs Avatar
  • Pnd72 Avatar
  • ejini战神 Avatar
  • akar-0 Avatar
  • XoRMiAS Avatar
  • saudiGuy Avatar
Ad