I'm going to answer this with basically the same answer I posted on a similar question, modified to this specific instance of course:
To explain it, let's take your second example line: 1 <Hello! Blah blah blah
Now, just that line does not contain any HTML - true. However, it gets inserted into HTML, which could cause some problems. Once run through the Markdown parser and rendered, the full HTML structure ends up looking something like this (again, simplified to make it easier):
<p>1 <Hello! blah blah blah</p>
Now, HTML is not that sophisticated. In the simplest of terms, it's a form of XML, which means anything within angled brackets could potentially be an element when you don't escape it properly. The first <p>
is obvious. However, the <
sign in the inequality, to any parser in the world, begins a new HTML element. So in reality, the entire <Hello! blah blah blah</p>
would get interpreted as a single start tag of a new element. That's certainly not ideal. So, an easy way to fix that is to just remove it. Invalid HTML elements, as well as tags that start but do not ever end, need to be removed so as not to interfere with the other display elements of the post.
This doesn't happen with your first inequality 1 < n < 4
because an HTML element tag cannot have a space between the opening angled bracket <
and the name of the tag, e.g. the tag < img>
would not be valid. Therefore, that does not get stripped by the Markdown rendered as "invalid HTML" because it is, itself, not valid HTML and therefore we don't need to worry about it.
In other environments where HTML is not allowed at all in the non-rendered version of the post, you could simply run the entire post through an HTML escaping function to replace the <
with <
and be happy. Unfortunately in an environment which does allow some actual HTML to be used, that's not possible, because then you'd be escaping real HTML elements which are meant to be rendered. It's far easier to just remove random things that shouldn't be used or just utterly don't make sense than to try and look at each HTML tag in a post and determine if it was used properly, if it has an appropriate end tag, etc, etc - HTML parsing is not any fun.
So, if you really want to use an inequality like that in your post, you should explicitly use the HTML entities yourself and not rely on the rendering engine to figure out what you're trying to do for you.
1<n<4
Although, that's much easier to read with the spaces in it anyways.