Is this plagiarism? Can I publish my work I happen to have worked on a Mathematical topic. The story is complicated.

It was not my original idea. My professor had already worked on it for a long time, intermittently. In fact, when we started out, I did not understand the concepts that well. Over a period of time, I picked up and managed to implement the algorithm myself; it proved to be even better than professor's implementation and speed was 10% faster. 

We were to publish this paper, but it took a different turn. The professor has some different thought process, and wants to prove a substantial finding. He has linked it to a thought that it can be better further. We have a complete discord of thoughts on this. I do not deny what he is saying is true, but I think it should be the next phase. Our work till now produces best results, of course - under certain conditions. 

I do not mind working with him further, and bringing it together to the research community. But I am going for a PhD. And I will not be physically available. I suggested an option of remote interaction, but the professor does not agree. He explained why meetings are important and why remote work cannot be carried out efficiently. After the discord, it is more of an ego issue, he did not directly indicate it. But I agree with most of his points on remote work being difficult.

But I have worked hard on the problem, sometimes 10 hours a day, for 5 complete months. And now I have to walk away without anything on my name. The nature of a professor is extremely dominating, and he will NOT mention my name in the paper once it comes to publishing after following his pathway. This is not my analysis, he clearly said this: "If you are not working on it any further, your name will not be included in the paper" He will probably find another student (MS level) and get it through. 

Now my questions are:


Can I publish work till now, as it is also a major finding? I firmly believe I completely understand what is being proposed, under what scenarios finding is valid, simply put, I own the work, even though original idea is not mine. I indirectly talked about this with professor, he nullified that this is even possible, indicating I should not.
Will this be termed as plagiarism? I am ready to mention professor's name, but he does not even agree to idea of publishing it at this stage. So I have two options: 

a. Mentioning his name as an author without his consent.

b. Mentioning him only in the acknowledgements, and also mentioning it was his idea and we worked together, but he does not agree this should be published without future additions. 
Will this come back to me in a bad way, possibly unimaginable to me at this point of time. I am just starting out my research career and do not want it to be hampered because of my behavior/attitude. 
Could you suggest any better way of resolving the situation? Talking to the professor is not really helping, yesterday we spent five hours discussing it. He is acting stubborn, uncooperative and because of that I have a feeling of wasting my six months. Of course, I learned lot in the process, my programming is much better now, my research methodology has improved. But unless I publish something, it remains only with me. I genuinely want to demonstrate my work, my abilities through a publication. 


Pl suggest. 

Edit_1_after_~20_months
I ended up not attempting to write a paper. At that time, I had a feeling that I did SO_MUCH work but have gained nothing, and wanted some output. I was wrong though, I learned how to approach a problem, how to carry out research iteratively, my programming improved a lot. The professor is still in touch. I have moved to different country and working on my PhD. Not having that work on my name does not matter a bit, but learnings do make a positive difference. I thank people who put out their thinking and suggestion. It was a vile effort from a bu**hurt person and that thinking does not make sense now.
There are a number of other questions on this site relating to these issues, although I'm not going to search for them now.

There are different issues going on here:

Firstly, you want to publish the bit of research you have done so far, but the PI thinks it should instead be turned into something more substantial before publishing. In this he is almost certainly right. It is not considered good practice to slice work into small pieces to get more papers.

You are considering publishing work with someone else against their wishes. Don't. Especially if you want to stay within the research community.

I take it you are concerned about having material for your PhD. Unless you are somewhere where publishing is a requirement for graduating, this is actually irrelevant. A PhD thesis should contain what you have done, and the normal progression of research is considered when assessing it.

You want to work remotely. I am confused as to who your PhD supervisor is. If he is your supervisor then you should expect to see him in person. If you are doing a PhD elsewhere, then how do you expect to have time to work on this project while also working full-time on your PhD topic?

Note also that writing a faster algorithm does not in itself really constitute new research in maths. Is there a particular theoretical change that made it faster? Or is it just that you coded a bit better? Does it actually make a difference in practical computational time, such that it allowed you to test some new examples that gave you the key insight for a theorem (or at least conjecture, or counter-example)?

The professor has said your name won't go on the final paper if you do no further work. It's possible that the professor is being unreasonable, and you can look up other questions along those lines. But the more likely situation is that your name won't go on the paper because what you have done doesn't count for authorship. Generally in mathematics the authors are only those who have contributed to what appears in the paper. It sounds unlikely that that would be true of the work you have done.

An unconventional solution, but one that would perhaps be more to your liking, might be to agree to release your write-up of your algorithm alongside the final paper, either as an appendix or as a separate paper. It probably won't do that much for you career-wise, but it might make you feel better and preserve your relationship with the professor. Also, by the time that happens you may be in a better position to admit that he's right. I know for myself it's hard to admit that your work isn't really that valuable, because it matters a lot to you. Over time you will become a little less emotionally involved.

Also, remember that this is someone you will want a reference from, if you are to stay in academia.