Ethics of not referencing StackExchange in a publication?
In my publishing experience, and from what I have seen elsewhere, I think the most appropriate thing to do in this scenario is to simply have an acknowledgment. This is standard for most professional publications.

For example, consider the article Counting Triangles to Sum Squares by Joe DeMaio that appeared in the College Mathematics Journal (a periodical of the MAA). Here's a snippet from the article:



As you can see, it would probably be appropriate for you to have an acknowledgment section at the end of your article that ran something like this:

Acknowledgment: Many thanks to members of the Math Stack Exchange community, anonymous and otherwise, for helpful comments and suggestions.