Collaboration or acknowledgment? This post is a sequel of: When should a supervisor be a co-author? 
This time the topic is about the interaction between two professional mathematicians (in particular junior-senior, but not necessarily).    
Of course, this will depend on the nature of the interaction (Q&A on a specific subject or talks or informal discussions), its frequency (1 time/year or /month or /week or /day) and also on the level of the mathematicians: what can look a high contribution for one, can look not so high for an other. Also, someone don't need or just don't want to be a co-author, because it's not enough high level for him.
I've also heard about senior mathematicians of high level, allowing several discussions on a specific joint work with a lot of contributors, and then becomes co-author, just by writing a nice introduction, but without having written any detailed proof: like a conductor and his musicians.   
Anyway, the mathematicians interact during conferences, by emails, on mathoverflow or in  their institute.    
Q:  How to distinguish the interactions which should lead to a collaboration  or to an acknowledgment?  


A general answer may be a proper adoption of the American patent law rejection (of a coautorship): the alleged research contribution by the coauthor does not rise to the dignity of research.   

Thus this would be the central question here. The general issue is the ethical quality of life in the creative environment (science, inventions, art, ...). Here we concentrate on mathematical research publications. Arguably, the research credit is in this case among the most vital issues, including cases of being prevented from a publication. The mathematical credit is given (or should be) for theories, theorems, conjectures, definitions, even notation. Smooth expositions and monographs are highly valued (and regularly win academic advencement for the authors) but they are not strictly research. Now about more specific questions (an invitation to Answer and Comment):
An acknowledgement within a paper: what is ethical? (examples)


*

*inside the regular text;

*a formal Acknowledgement at the end of Introduction or the whole paper;

*inside Introduction;

*credit for using an unpublished result of one of the coauthors.


Giving credit among the coauthors (in their paper): what is (not) reasonable?


*

*The order of listing the coauthors (mathematical default: alphabetic; there are exceptions);

*Coauthors are discrete about the division of credit among them (mathematical default) or sometimes they spell out each author's contribution.


Kleptomania and stealing (never mind acceptable, but how to prevent it?)
More questions can be raised or some may be even erased.

An opinion (wh): a publication should adequately represent the research contributions of all involved, both of (co)authors and by others (non-coauthors). The word is adequately, without unnecessary details or assigning any weight to the researchers. A coauthor whose research contribution does not rise to the dignity of research should not be a coauthor.

 A: I don't agree with the specific rules used by Hardy & Littlewood, but if you're going to have an ongoing collaboration with someone it helps avoid misunderstandings to have established rules. The ones I usually use are:


*

*To be a co-author, it is necessary and sufficient that you can point to some particular idea in the paper that you contributed. It doesn't have to be a large idea or an equal share, but there has to be something.

*Being in the room while the research was discussed but not contributing is not good enough.

*It doesn't matter whether you've collaborated before on the same subject. Subsequent papers on the subject can be with or without you, depending on whether you contribute any ideas.

*If your idea is superseded by an unrelated idea or otherwise doesn't make it into the paper, tough luck, but that's also not good enough.


However, I've also had collaborations with looser (but still explicit) rules, e.g. anyone who was present when the research was happening can request to be a co-author, subject only to their own conscience.
A: I'd say credit for my thesis was done artfully!  The potential coauthor is rather big in the field, and so as to not "dwarf" me this person chose to not publish with me.  The major result was mine, however, my first result was refined by this person.  I certainly did ask them to publish with me, even legitimately wanted them to, with "no" being the answer.  I still give credit where it's due - not that they need it, mind you!      
A: TITLE:
$\ \ 2\times 2\ $ publications, and one non-publication + extra.

Mainly facts only are stated. You may draw your own conclusions.

Case 1   Two relatively young mathematicians published their joint paper, which was first for both of them. They didn't have much contacts outside their immediate mathematical neighborhood. Nevertheless, they and their result were quoted in some conference proceedings on the other side of the ocean, quite before their paper showed in the print. Indeed, their third friend published a different result but on the same topic still earlier. That's how the first two got recognition. The third friend clearly quoted the two others and their result.

Opinion: if not for the chronologically earlier publication, there would be a chance that other mathematicians would get the same result as the first two friends, and these other mathematicians would get the credit--then the situation of the two friends would be more difficult.

Case 2   A student solved a problem posed by his teacher (not a PhD supervisor). It was at the end of a conference. At the moment the student had only a special case but it was clear to both of them that the student virtually solved the problem (The student's name will appear here as X). They parted and didn't have any contact for about a year. The older mathematician was stimulated by his student's solution and he too solved the problem, the next day, but sent it to a journal some months later. The very first sentence of the paper says: Introduction. The main aim of this paper is to give a new proof of the following X's Theorem:, and the theorem followed. The author got a referee report stating that there should be one joint paper (and even claiming or clearly implying that the author acted not ethically). The author replied, the editors apologized to the author, regretting that the sending that report was an error on the editor's part.
There was a happy ending. The student was informed by editors, he quickly sent his paper, and the two papers showed up back to back in the same magazine issue, the student's paper first--virtually without any significant delay. It was that student's first publication.

Opinion: It is much more important to an unpublished and unknown mathematician to get credit for her/his original result than to be a coauthor, especially when the other coauthor is a well established mathematician. Furthermore, it is un-ethical for an author of the second proof to appear as the coauthor of the result--it should be stated explicitly who is the original solver, and who provided the second proof; then it would be fair, it would reflect the reality. If the first proof was complicated or messy (but complete) then the author of the second proof should simply publish her/his proof by her/himself, and should clearly inform about the original solver. This way the original solver still gets the credit for solving the problem but not for the elegance of the other proof--this is fair too. The experienced mathematician should not dilute the credit of the novice.

Case 3 & 4: (I'll write later. Actually, if these notes are not welcome then I am very willing on giving up on it, and even on removing Case 1&2, i.e. the whole Answer)
A: No general rule can be established here. It is by mutual agreement of all involved parties that such things are usually decided. If you decide to write a paper where you use the results of
a discussion with someone, you just ask the people with whom you discussed the matter whether they want to be co-authors, and whether they are willing to make any further contribution.
Another thing is a permanent of systematic collaboration with someone, in which case, on my opinion, the best thing is to follow thew Hardy-Littlewood collaboration rules:
http://moleseyhill.com/blog/2010/03/22/hardy-littlewood-rules/
EDIT. It was surprising to obtain so much feedback on the Hardy-Littlewood rules which are so simple and natural. Unfortunately nobody explained what (on their opinion) is wrong with Axiom 4 and other axioms, or what is the difference between the "present day collaborations" and those in the beginning of 20-th century. 
Anyway, I feel happy with all those rules and always practice them with my permanent collaborations. I have many of them, and never had a slightest misunderstanding (not speaking of a quarrel) with my collaborators about co-authorship.
EDIT2. In the case of permanent/continuous/frequent collaboration, nothing better was ever proposed than the H-L "axioms". The case of occasional collaboration is more complicated. Here are the approximate rules I follow:
If I feel that there should be a publication, and there is a person with whom I discussed the subject and this person said something reasonable which I did not know, then I would offer a co-authorship. If the person declines, I can make some arguments to convince him/her. If s/he continues to decline, I either write the paper myself, and thank this
person, or (if I feel that her contribution is very substantial), the thing remains unpublished. Some beautiful theorems remain unpublished, and will never be
published, because a co-author declines:-(
A contribution can be anything. Statement of a problem (that is a specific conjecture,
unpublished) can be a contribution which is sufficient for co-authorship. (For this reason I think that a thesis adviser is almost always eligible for co-authorship. But most advisers, including myself,  would decline in most cases.)
As Rene Thom said once, "even a fool can prove theorems". Stating a good conjecture
(correct or not) can be much more than 50% of the contribution. Similarly, a hint how to solve it can be
also crucial.
Sometimes one sentence said in a conversation can be crucial. It does not matter, who wrote the final text, and who did the details of the proofs.
A: I've always followed this algorithm:


*

*When in doubt, coauthor. All contributors who made a not negligible personal contribution are listed as coauthors. List author who contributed most as the first author. I for one think copublishing with a senior scientist helps the younger scientists. Notice that I write "not negligible," not necessarily "significant". Coauthors need not write the text, if they don't want to.

*The contributions of the several authors are indicated explicitly in the paper ("the first author suggested that ..." or "the second author proved ..."), if there is a reason for it. E.g., the senior author discovered a new problem, and the junior author solved it, or vice versa, etc., etc. In other words: ignore this step iff they both contributed to each aspect of the paper to some extent.

*In the paper or monograph, if still in doubt, go ahead and list everybody as a coauthor (be generous, include your friends), acknowledge the administrators whom you want to be friends with, and fictionally attribute (in the text) the results or contents to Euler's collected works, which you are generalizing, you explain, or to somebody else (be creative, in the same way Condillac cited Pascal). You can always clear it up later and in case you do, it's another paper for you to write, if you later find that you need a problem that in turn needs urgent funding.
EDIT: (1) is like that for the reason, sometimes forgotten, that you may decide to collaborate with another scientist who is not a mathematician. They may not comprehend all the details of the mathematical content of the paper, which may nevertheless be purely mathematical in it's scientific contribution, and published accordingly. If the rule is that each coauthor must contribute significantly to the mathematics, you arbitrarily avoid participation in usual cases of published interdisciplinary collaboration. And why would you do that?
