Answered step by step
Verified Expert Solution
Question
1 Approved Answer
If we list all the natural numbers below 10 that are multiples of 3 or 5 , we get 3,5,6 and 9 . The sum
If we list all the natural numbers below 10 that are multiples of 3 or 5 , we get 3,5,6 and 9 . The sum of these multiples is 23 . Find the sum of all the multiples of 3 or 5 below 1000. Directions for discussion: Part I: Please post your solution by providing the algorithm that produces the correct answer. Please include a link to the repl.it implementation of the algorithm in your favorite programming language. Part II: Explain how this problem can be done by hand. Note the formula 1+2+3+4++n=2n(n+1). Now consider it's variation: 3+6+9+12+15++3n=3(1+2+3+4+5++n)=23n(n+1) where we factor out n, and obtain a similar formula for the sum of multiples of 3. Using this formula, as well as the formula for 5 explain how you would find the answer in Part I using pencil and paper (and maybe a basic calculator). HINT: Be sure to find an ingenious way to remove the duplicates to ensure you're getting the right answer. Part III: Consider one of the possible variation on this problem (below), and comment on how this new variation would change the possibilities for a handcalculation, and/or the coding needed to find the solution. Are there any variations below that could not be completed using pencil and paper? Here are possible variation: (a) Find the sum of all the multiples of 3 or 5 or 7 or 11 below 1000. (b) Find the sum of all the multiples of 3 or 6 or 18 below 1000. (c) Find the sum of all the multiples of 3 and 5 and 7 and 11 below 1000 . (d) Find the sum of all the multiples of 3 and 6 and 18 and 36 below 1000
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started