this is not necessarily true. lots of things will have frequencies that vary (inversely) proportional to length and hence to weight. so it would depend on the shapes of the anvil hammers that Pythagoras heard. if they were of approximately equal cross-sectional area and varied only in length end-to-end, their modal frequencies excited by end-on striking would be (inversely) proportional to their weights.
searching for accounts of this, i found one, below:
^ <http://oregonstate.edu/%7Ecoolmanr/WhyTwelve/references.html>from
The Cambridge History of Western Music Theory, page 10:
In Chapter 6 of The Manual of Harmonics (early second century CE),
Nicomachus of Geras narrates the legendary story of Pythagoras
passing by the blacksmith's shop, during which in an epiphany of
sonorous revelation, he discovered the correlation of sounding
intervals and their numerical ratios. According to the Nicomachus,
Pythagoras perceived from the striking of the hammers on the anvils
the consonant intervals f the octave, fifth, and fourth, and the
dissonant interval of the whole tone separating the fifth and forth.
Experimenting in the smithy with various factors that might have
influenced the interval differences he heard (force of the hammer
blows, shape of the hammer, material being cast), he concluded that
it was the relative weight of the hammers that engendered the
differences in the sounding intervals, and he attempted to verify
his conclusion by comparing the sounds of plucked strings of equal
tension and lengths, proportionally weighted according to the ratios
of the intervals. [3]
[3] Levin, The Manual of Harmonics, pp. 83-97. a related version of
the Pythagorean myth is narrated in Chapter 5, pp 142-143.
if this account is historically true, then Pythagoras was certainly on the right track, if wrong in specifics. a modern view would require analysis of the dynamics of sound-producing objects. this brings in shape, weight, material stiffness, all in one errr harmonious package.
Les
Les