Problem 49. Sums with Excluded Digits
Add all the integers from 1 to n in which the digit m does not appear. m will always be a single digit integer from 0 to 9.
no_digit_sum(10,1) = 44
because 1 and 10 are excluded from the sum and
sum(2:9) = 44
Solution Stats
Problem Comments
-
2 Comments
Sanzhar Askaruly
on 28 Jul 2019
simple but fun :)
Chris Liu
on 16 Jul 2024
My solution looks complicated but runs very fast, trust me :)
Solution Comments
Show commentsProblem Recent Solvers2357
Suggested Problems
-
Find the sum of all the numbers of the input vector
53502 Solvers
-
The Goldbach Conjecture, Part 2
2412 Solvers
-
11921 Solvers
-
Return the first and last characters of a character array
11740 Solvers
-
Generate a vector like 1,2,2,3,3,3,4,4,4,4
13525 Solvers
More from this Author96
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!