In my opinion, what makes something legal or illegal is because we are in a certain legal area. So whatever it is, what determines whether it is legal or not is the legal body or institution that has authority in the region or country in which we live. Yes, math is legal, but it's not just about this. And when a country formulates whether something is legal or not, it is not only seen from whether it is computer based or not. but to the fundamentals, underlying, and so on which makes them formulate a law in their area.
But fortunately I live in a country where Bitcoin and other cryptocurrencies are legal, but only as a commodity asset, not as a means of payment.