Ramanujan’s observation about 1729 is actually quite interesting and not at all whimsical or silly. It was that is is the smallest number expressible as the sum of two cubes in two different ways:
1^3 + 12^3
10^3 + 9^3
Ramanujan probably derived this on the spot (by familiarity with the low cubic powers, and eliminating all the other sums of the low cubics [(n-2)^3 + (n-1)^3 only exceeds n^3 for n>7]). But he may have already been familiar with this property, since it was first found by Frenicle (along with 4 other, higher numbers expressible as such a pair of sums of cubes) as a solution to a challenge put forth by Euler.