Computer Science, asked by yogajons00, 8 months ago

6) Print the following series using switch case as given below:
1. 1, 11, 111, 1111,...Upto 10 terms
2. 1+4+9+16+......Upto 10 terms​

Answers

Answered by noorahfatima73
1

Consider the following composite series,

1+11+111+1111+…+(1111…n 1's)1+11+111+1111+…+(1111…⏟n 1's)

=1+(1+10)+(1+10+100)+(1+10+100+1000)+…+(1+10+100+1000+…+10n−1G.P with n number of terms)=1+(1+10)+(1+10+100)+(1+10+100+1000)+…+(1+10+100+1000+…+10n−1⏟G.P with n number of terms)

Each term of above series is sum of a G.P. whose first term is 1 & common ratio is 10 hence nth term of above series is Tn=1⋅(10n−1)10−1=10n−19Tn=1⋅(10n−1)10−1=10n−19

Hence, the sum ( SnSn ) of n terms of such series having nth term Tn=10n−19Tn=10n−19 is given as

Sn=∑n1Tn=∑n110n−19=19∑n1(10n−1)=19(∑n110n−∑n11)Sn=∑1nTn=∑1n10n−19=19∑1n(10n−1)=19(∑1n10n−∑1n1)

=19(10(10n−1)10−1−n)=181(10(10n−1)−9n)=19(10(10n−1)10−1−n)=181(10(10n−1)−9n)

Hence, the generalized formula to get sum of n terms of this composite series

[Math Processing Error]

hence substituting n=5n=5 in the above generalized formula for given series 1+11+111+1111+111111+11+111+1111+11111 having five terms, the sum is given as

1+11+111+1111+11111=181(10(105−1)−9⋅5)=123451+11+111+1111+11111=181(10(105−1)−9⋅5)=12345

Alternatively, one can fairly easily add all five terms of given series as follows

1+11+111+1111+11111––––––––=12345

In looking at the given sequence: 1, 4, 9, 16, 25, ..., we see that the difference d between each term and the one immediately before is variable and not constant; The difference d is a consecutive odd positive integer beginning with 3:

2nd term - 1st term = 4 - 1 = 3, where 2nd term = 1st term + d = 1 + 3 = 4

3rd term - 2nd term = 9 - 4 = 5, where 3rd term = 2nd term + d = 4 + 5 = 9

4th term - 3rd term = 16 - 9 = 7, where 4th term = 3rd term + d = 9 + 7 = 16

5th term - 4th term = 25 - 16 = 9, where 5th term = 4th term + d = 16 + 9 = 25

.

.

.

(n-1)th term- (n-2)th term=2(n-1)-1, where a(n-1)= a(n-2)+d=a(n-2)+[(2(n-1) - 1]

nth term - (n - 1)th term = 2n - 1, where an = a(n - 1) + d = a(n - 1) + (2n - 1)

NOTE: Looking at the above pattern for the variable difference d between any two consecutive terms in the sequence, we can see that the formula for calculating d is: d = 2n - 1, where n = the integral number of the term under consideration, for example, for determining the 6th term of the sequence, the necessary difference d between the 6th and 5th terms is: d = 2n - 1 = 2(6) - 1 = 12 - 1 = 11.

Therefore, the next four (4) terms in the sequence are:

6th term = 5th term + d = 25 + (2n - 1) = 25 + (2(6) - 1) = 25 + 11 = 36

7th term = 6th term + d = 36 + (2n - 1) = 36 + (2(7) - 1) = 36 + 13 = 49

8th term = 7th term + d = 49 + (2n - 1) = 49 + (2(8) - 1) = 49 + 15 = 64

9th term = 8th term + d = 64 + (2n - 1) = 64 + (2(9) - 1) = 64 + 17 = 81

Therefore, the completed sequence should look something like this:

1, 4, 9, 16, 25, 36, 49, 64, 81, ... , [a(n - 1) + (2n - 1)]

mark as brainlist dear

Answered by priyaranjantbk
0

nonsense,ediet,rascle

Similar questions