e = 3
n = 10
M = 7
phi(n) = (5-1) * (2-1) = 4
ed = 1 mod 4
3d = 1 mod 4
d = 3
why is this impossible for a useful RSA code?
I don't know what you mean, it is a correct key generation mathematically speaking. Now, you can see that, which is not great cryptographically speaking. And your semiprime is even (instant factorization). And your values are very small.
So what do you mean by "impossible" ?
It is a valid RSA setup.
It is not very useful unless your alphabet only has 10 characters.
Not impossible.
But, not very useful.
Your alphabet may have 26 or 67 or 360 alphabetic characters, but when it is decoded you are going to have only 10 characters {n: 0,1,2,3,4,5,6,7,8,9 }
If you use the above to encode a message, you will use 1 character of plain_text to generate 1 character of cipher_text.
After the tenth character you are going to get a 1 to 1 relationship. It becomes a simple substitution cipher.
Typically, you would want to encode a group of characters at a time.
Suppose you have a group of plain_text (say 12 characters of your which are ALL ones: 111111111111) and generate a cipher_text.
If you change a single bit in the plain_text (111111111121) you want generate a completely different cipher_text that has NO similarity to the other cipher_text.