text: To store the sum and sum of squares of the array elements
code: $ sum = 0 ; $ sumSq = 0 ; for ( $ i = 0 ; $ i < $ n ; $ i ++ ) { $ sum += $ arr [ $ i ] ; $ sumSq += pow ( $ arr [ $ i ] , 2 ) ; } $ B = ( ( ( $ sumSq - $ sumSqN ) / ( $ sum - $ sumN ) ) + $ sumN - $ sum ) / 2 ; $ A = $ sum - $ sumN + $ B ; echo " A = " , ▁ $ A , ▁ " B = " }