Whilst watching a Swan Lake ballet at The Barbican Centre a couple of months ago (and confirming my suspicions that ballet is not very captivating to me) I was distracted by the geometrical formations that the ballerinas took on — in one sequence they were neatly arranged in a triangular layout, and then quickly moved into a square layout.
That was my cue to set about trying to deduce which triangular numbers also happen to be square numbers (and therefore work out how many ballerinas were on stage, without actually counting them) with the additional challenge of doing it all in my head, whilst continuing to watch the performance. (I figured that whipping out a notebook might be considered somewhat unsavoury, and more importantly, I had omitted to bring one with me!)
I managed to conclude, during the course of the performance, that the first integer greater than one to be a triangular number as well as a square number is 36. However, the number of ballerinas present in the curtain call were far fewer. I must have made a mistake in my observations somewhere — perhaps the square and/or triangle were incomplete? Perhaps there were 15 in the triangle and then an extra one sneaked in to make 16 for the square?
Later in the week I had a crack at coming up with a general solution.
As you can see, I didn't get very far (perhaps my mathematics is getting a little rusty through disuse) but a quick brute-force in Excel came up with the following results:
Numbers which are both square and triangular: