maths
posted by rajshekhar .
All the students in a school are made to stand in rows so as to form an equilateral triangle. The first row consists of one student, the second row 2 students, third row 3 students and so on. Had there been 90 more students, the total number of students could have been arranged in the shape of a square, so that each side of the square has 5 students less than the number of students in the side of the triangle. Find the total number of students initially present in the school?

You are dealing with the triangular numbers whose sums of consecutive rows would be
1 3 6 10 15 21 28 ...
these numbers are generated by (n^2+n)/2 for n equal to the set of natural numbers.
So I added 90 to each of these to see if I get a perfect square.
The first such n value was at n=4
the sum of students would have been 10, and adding 90 gave me 100.
But that did not satisfy the second condition you gave, namely that the side of the square had to be 5 less than the side of the triangle.
I kept going for a while, almost gave up, but came to n = 26
the sum of the students in the triangle is (26^2 + 26)/2 = 351
adding 90 got me 441 which is 21^2
and the difference between these is indeed 5
so there were initially 351 students in the school