Though the reasonings which you have urged, Cleanthes, may well excuse me, said Philo, from starting any further difficulties, yet I cannot forbear insisting still upon another topic. It is observed by arithmeticians, that the products of 9, compose always either 9, or some lesser product of 9, if you add together all the characters of which any of the former products is composed. Thus, of 18, 27, 36, which are products of 9, you make 9 by adding 1 to 8, 2 to 7, 3 to 6. Thus, 369 is a product also of 9; and if you add 3, 6, and 9, you make 18, a lesser product of 9. To a superficial observer, so wonderful a regularity may be admired as the effect either of chance or design: but a skilful algebraist immediately concludes it to be the work of necessity, and demonstrates, that it must forever result from the nature of these numbers.
This passage has always bothered me, and I think I've put my finger on why. It is true that the feature involved is "the work of necessity", but it is a necessary feature of a base-10 place-value numeral system, and that is a work of design. The claim is not true if you shift the base, and the claim is not true in a different system of numerals (e.g., Roman numerals or simple tallies). Thus the actual situation is this:
(1) It would be possible (although in fact it almost certainly is not) for someone to design the system we have (or something like it) for the purpose of having a numeral system in which this property in fact obtains. Then, besides being a necessary feature of the system, it would be part of the system's design, in the same sense that certain principles will always be necessary for any system you design.
(2) As is vastly more likely, the numeral system was designed for other purposes (simplifying counting, etc.), and this feature was preterintentional, just not in view at all. In this sense we can say that it is a chance feature -- it was not part of the design, but as it happens is a necessary feature of the kind of system we chanced on actually making in order to fulfill our intentions. In which case it can be a chance feature while also being a necessary feature.
What Hume actually needs for the argument he wants, of course, is some much more fundamental property of numbers that does not depend on the choice of how you record them. But even doing so, he is still going to run into the fact that the necessity of the internal relations of the system and the necessity of the system actually used is not the same; the former is not enough to get the exclusion of design he is suggesting. This doesn't affect Philo's overall argument -- Philo is in fact not really making much of an argument, but only saying that, since others brought necessity into the discussion, perhaps everything is in fact absolutely necessary and we just don't know it. It's just that the example chosen is poorly suited for his particular purpose, because it doesn't actually express an absolute necessity, but only an internal necessity of one system among many.
All of this seems related to a topic I've discussed before, namely, that when we call mathematics a 'universal language', we seem to be equivocating -- in the sense in which mathematics is universal, it is not a language, and in the sense in which it is a language, it is not universal. Mathematics in practice is not a matter of pure necessity; we have to construct things to reason about mathematical necessities, and we can construct things in very different ways. This is obviously true of geometry, but it is true of arithmetic as well, since the numeral systems by which we reason about numbers are constructed in order to reason about them.