Question: I can imagine that finding $p,q,n$ are easy, but my text book also says the $e$ can be found rapidly, so how does modern RSA find this $e$?

![RSA as a Public Key System](https://i.stack.imgur.com/LBR7F.png)

Answer: 
[OAEP](https://en.wikipedia.org/wiki/Optimal_asymmetric_encryption_padding) - Optimal Asymmetric Encryption Padding may be what you want. 

In RSA public-key encryption system, in order to prevent partial decryption, OAEP padding is used. In essence, it's a Feistel network with randomizing element. 

When used alone, it can ensure no partial information can be derived from any partial information, but when the whole message is available, it's trivial. 

In your case, this is no longer encryption - it's secret sharing. 

[Related link](https://en.wikipedia.org/wiki/All-or-nothing_transform)
I believe this can be achieved, but of course you need to secure both of your encryption and decryption algorithms. Hide it on a very secure server with a rest endpoint where authentication is needed to be able to use the rest service. so to use the algorithm you need to send authenticated requests to your secure endpoint. Also dont forget to obfusicate your production codes. 

If you are new to writing encryption algorithm you can start by learning som simple trans table encoding just to get a start. 
Your key will be mathematics and with the use of strong psuedo random number generators. So if you store all results in a database, be sure to use encryption and not pure encodings cause it will be easy to crack. 

Why not try to create a random number generator too while your at it. If you can calculate the n^x decimal of sqrt(2) or Pi, or some othe irrational number you can create your own deviation to produce a strong non standard prn. 

If you belive your encryption is strong enough try to give a sample of x number of pure values and the values of the encryption to see if anyone can crack them.

And lastly don’t take my word on any of this Im just a noob, with an imagination that I know something I dont, I do other stuff for a living.