We generalize a result of Bateman and Erdos concerning partitions, thereby
answering a question of Compton. From this result it follows that if K is a
class of finite relational structures that is closed under the formation o
f disjoint unions and the extraction of components, and if it has the prope
rty that the number of indecomposables of size n is bounded above by a poly
nomial in n, then K has a monadic second order 0-1 law. Moreover, we show t
hat if a class of finite structures with the unique factorization property
is closed under the formation of direct products and the extraction of inde
composable factors, and if it has the property that the number of indecompo
sables of size at most n is bounded above by a polynomial in log n, then th
is class has a first order 0-1 law. These results cover all known natural e
xamples of classes of structures that have been proved to have a logical 0-
1 law by Compton's method of analyzing generating functions.