Pattern Sum - MATLAB Cody - MATLAB Central

Problem 44523. Pattern Sum

Difficulty:Rate

Write a function which receives two single digit positive integers, (k and m) as parameters and calculates the total sum as: k + kk + kkk + .... (the last number in the sequence should have m digits) For example, if the two integers are: (4, 5). Your function should return the total sum of: 4 + 44 + 444 + 4444 + 44444. Notice the last number in this sequence has 5 digits. The return value should be 49380.

Solution Stats

46.82% Correct | 53.18% Incorrect
Last Solution submitted on Jan 06, 2025

Problem Comments

Solution Comments

Show comments
MATLAB Central 2024 In Review
...
Let's celebrate what made 2024 memorable! Together, we made big impacts, hosted...

Problem Recent Solvers217

Suggested Problems

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Go to top of page