The problem is to show that the composite numbers are the finite spectrum of a sentence in some language. The hint given is to consider subgroups and cosets. (I am aware there are other solutions to this problem, e.g. here: https://math.berkeley.edu/~scanlon/m125f05/mt2sol.pdf, but I am interested in a solution using the hint, i.e. utilising groups/subgroups).
My thoughts: so it seems we want to find a first order sentence, (presumably in the language of groups?) which says that a group has a proper, nontrivial subgroup. This then implies the group has composite order. However I could not think of such a sentence. Is there such a sentence? Or is there another way to do it? Thank you for any help.
Hint: you can't quantify over subgroups in the first-order language of a group. You can talk about groups with a chosen subgroup, if you extend the language with a one-place predicate symbol to denote the set of elements of the subgroup. Now do you see what to do?