From 327b74b89dbfcb0a4c295f73b663e616b08dab4b Mon Sep 17 00:00:00 2001 From: mahimadubey <54871679+mahimadubey@users.noreply.github.com> Date: Tue, 20 Oct 2020 09:45:51 +0530 Subject: [PATCH 1/2] Update arithmeticProgressionSumFunc.py --- mathgenerator/funcs/arithmeticProgressionSumFunc.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mathgenerator/funcs/arithmeticProgressionSumFunc.py b/mathgenerator/funcs/arithmeticProgressionSumFunc.py index 294cb7f..cd324a8 100644 --- a/mathgenerator/funcs/arithmeticProgressionSumFunc.py +++ b/mathgenerator/funcs/arithmeticProgressionSumFunc.py @@ -10,7 +10,8 @@ def arithmeticProgressionSumFunc(maxd=100, maxa=100, maxn=100): n = random.randint(4, maxn) apString = str(a1) + ', ' + str(a2) + ', ' + str(a3) + ' ... ' problem = 'Find the sum of first ' + str(n) + ' terms of the AP series: ' + apString - solution = n * ((2 * a1) + ((n - 1) * d)) / 2 + an=a1+(n-1)*d + solution = n * (a1+an) / 2 return problem, solution From 32d7fe0da1cc6d80a9e6ea241b1968866044db3f Mon Sep 17 00:00:00 2001 From: mahimadubey <54871679+mahimadubey@users.noreply.github.com> Date: Tue, 20 Oct 2020 14:11:29 +0530 Subject: [PATCH 2/2] Update arithmeticProgressionSumFunc.py --- mathgenerator/funcs/arithmeticProgressionSumFunc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mathgenerator/funcs/arithmeticProgressionSumFunc.py b/mathgenerator/funcs/arithmeticProgressionSumFunc.py index cd324a8..014d27c 100644 --- a/mathgenerator/funcs/arithmeticProgressionSumFunc.py +++ b/mathgenerator/funcs/arithmeticProgressionSumFunc.py @@ -6,7 +6,7 @@ def arithmeticProgressionSumFunc(maxd=100, maxa=100, maxn=100): d = random.randint(-1 * maxd, maxd) a1 = random.randint(-1 * maxa, maxa) a2 = a1 + d - a3 = a2 + d + a3 = a1 + 2*d n = random.randint(4, maxn) apString = str(a1) + ', ' + str(a2) + ', ' + str(a3) + ' ... ' problem = 'Find the sum of first ' + str(n) + ' terms of the AP series: ' + apString