Denote by the -th prime number (, , , , \dots). Let be a rooted tree with branches . The Matula number of is , starting with . This number was put forward half a century ago by the American mathematician David Matula. In this paper, we prove that the star (consisting of a root and leaves attached to it) and the binary caterpillar (a binary tree whose internal vertices form a path starting at the root) have the smallest and greatest Matula number, respectively, over all topological trees (rooted trees without vertices of outdegree 1) with a prescribed number of leaves – the extreme values are also derived.