Purchase Solution

Combinatorial Techniques : What is the algorithm for computing the sum of an arithmetic progression of n terms with first term a and common difference d?

Not what you're looking for?

Ask Custom Question

What is the algorithm for computing the sum of an arithmetic progression of n terms with first term a and common difference d?

--------------
Step 1 Set S = a, k = 1, and t = a.
Step 2 while k < n
(a) Replace t with t + d
(b) Replace S with S + 1
(b) Replace k with k + 1
endwhile
Setp 3 Print S.

How did you determine this? Need tutoring help so I can learn how to answer additional ones. Thanks and Happy New Year!

Purchase this Solution

Solution Preview

As far as I understand it, you wanted an algorithm for a function that will accept *variables*, which are a (the first term), d (the difference between consecutive terms) and n (number of terms).
Thu function should return a single number "Sum" which is the sum of all the terms in the series.

First, note that the algorithm that you provided in the question is completely wrong. Replacing S with S+1 simply raises the sum accumulator by 1, which is obviously wrong if the difference between consecutive terms is more ...

Purchase this Solution


Free BrainMass Quizzes
Probability Quiz

Some questions on probability

Exponential Expressions

In this quiz, you will have a chance to practice basic terminology of exponential expressions and how to evaluate them.

Know Your Linear Equations

Each question is a choice-summary multiple choice question that will present you with a linear equation and then make 4 statements about that equation. You must determine which of the 4 statements are true (if any) in regards to the equation.

Solving quadratic inequalities

This quiz test you on how well you are familiar with solving quadratic inequalities.

Multiplying Complex Numbers

This is a short quiz to check your understanding of multiplication of complex numbers in rectangular form.