138

Theory:
Perfect square problem.Problem is to determine a pair of numbers where the small (lower_num) number divides the numbers from 1 up to higher_num into two groups in a way that summation of 1 to (lower_num-1) is equal to summation of the numbers from (lower_num+1) to higher_num.
Expanation: first pair 6 8
summation of 1 to 5 = 5*(5+1)/2 = 15
summation of 7 to 8 = 7+8=15
so, 5*(5+1)/2 = 8*(8+1)/2-6-5*(5+1)/2, here n*(n+1)/2 formula is used.
so if we assume the lower_num=divider;
then (divider-1)*divider/2=summation of 1 to higher_num – divider – (divider-1)*divider/2.
=> (divider-1)*divider + divider = summation of 1 to higher_num;
=> divider^2 – divider + divider = Sum_hi;
=> divider = sqrt of Sum_hi;
Solution:

 

Leave a Reply

Your email address will not be published. Required fields are marked *