Iterative sum of digits of 2^n number - MATLAB Cody - MATLAB Central

Problem 43019. Iterative sum of digits of 2^n number

Difficulty:Rate
Given n, calculate the number 2^n (where n>=0) and iterate until the sum of the digits is a single-digit number.
Example:
Input n = 7
Output sum = 2
because 2^7 = 128, and 1+2+8=11 and 1+1=2.

Solution Stats

43.21% Correct | 56.79% Incorrect
Last Solution submitted on Jul 24, 2024

Problem Comments

Solution Comments

Show comments
R2025a Pre-release highlights
This topic is for discussing highlights to the current R2025a Pre-release.
13
5

Problem Recent Solvers30

Suggested Problems

More from this Author2

Problem Tags

Community Treasure Hunt

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

Start Hunting!
Go to top of page