+ 4

How do i calculate something like this in python? (n*(n-1))/2= 1128 i.E. n is unknown. I can't do it like x = (n*(n-1))/2= 1128

Python, math, no idea to solve

17th Sep 2017, 8:08 AM
Da Riebi
Da Riebi - avatar
6 Antworten
+ 7
mathematical steps: (n*(n-1))/2=1128 n*(n-1)=2256 (n-0.5)^2=2256.25 (n-0.5)=47.5 n=48
17th Sep 2017, 8:22 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 5
Use math
17th Sep 2017, 8:10 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 3
Math solution : n*(n-1)/2 == 1128 <=> n*n/2 - n/2 - 1128 == 0 == a*n*n + b*n + c Here you can solve it like a quadratic equation a = 1/2 b = -1/2 c = -1128 delta = b*b - 4*a*c = 1/4 + 4*1128*1/2 > 0 so there are 2 solutions (-b - sqrt(delta))/ 2*a (-b + sqrt(delta))/ 2*a
17th Sep 2017, 8:26 AM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 2
"use math" lol
17th Sep 2017, 8:24 AM
Anton Gutman
Anton Gutman - avatar
+ 1
thanks for your answers. :-)
17th Sep 2017, 10:23 AM
Da Riebi
Da Riebi - avatar
0
hi
18th Sep 2017, 2:33 AM
naime islam