Publishing a paper as the sole author (undergraduate) I am an undergraduate student and I have been working with a computational physics group for three years.

Over the past three years, the code I used for our research has grown from one simple algorithm to a very complex and expansive suite of numerical tools for both simulations and investigating analytical solutions of the specific nonlinear partial differential equation we are interested in. This program has been vital to the two papers I've published during my junior year.

I am working with two professors, professor A and professor B. I showed professor A my program a couple of months ago and he was very impressed. He suggested that I submit it as an original software publication in the journal Computer Physics Communications which publishes such things. He said that I should be the sole author on the paper since I did all the work myself and no one else had any significant contribution. I discussed this with him again a few days ago, saying he and professor B should be my coauthor, but he said it would be dishonest since it's my own work and they didn't really contribute.

However, having known professor B for a few years, I know he likes to have his name on all papers published by our group/international collaboration, whether or not he had a sizable contribution (I don't mean to disrespect him in any way, just an observation, he even says so himself). I have no idea how I should tackle this issue. On the one hand, professor A refuses to be the coauthor and believes I deserve to be the sole author, which of course could be very beneficial for my PhD application. On the other hand, I do not want to upset professor B, and I will inevitably need their help in revising the paper (I'm sure A wouldn't mind revising it, however). I still haven't talked to professor B and I don't know how to bring it up.

Edit: I just emailed professor B, explained the situation and asked him for advice on which option would be best, he replied saying "it would be nice if you can publish a paper on your own." So I guess that's what I'll try to do. Thank you everybody for the advice, I've learned my lesson.
It seems that it is not an ego issue for you even slightly and so if it's easier you might grease Professor B by offering him a co-author credit if he'll handle the revisions and creative changes you hint are needed.  If nothing else you will learn if he is missing the work ethic in addition to completely missing out on integrity already.

You might ask B if he would edit the paper and make the needed changes in exchange for a co-author credit.  As a courtesy you might also consider mentioning that idea to give Professor A a long distance call first so he won't be surprised by finding out about the two you you sharing credit and not including him after the fact.  Men of integrity are not missing from professional teaching completely but i wouldn't say they are not all that common either so I would want to grant him that small courtesy I think he is due.

Life can be easier when you let the Professor B's of this world help themselves to some of what is yours on occasion and getting in their way can make life unnecessarily complicated sometimes.

Then again sometimes telling them to stuff it is just too much fun to pass up.  (You end up having to deal with them anyway though, about every fourth time or so you can get knocked on your ass by these guys.  Either way you'll have done the right thing for at least one good reason.