Mathematics behind end-to-end encryption I am interested in end to end encryption, recently I read some articles on its principles but I can't find anything on the maths behind the encrypting and decrypting functions that relates private and public keys. I remember to have read that they are related with prime numbers and elleptic functions but I haven't find anything else. 

Can anyone tell me something else about it or suggest me an article/book on it?
End-to-end encryption refers only to the -- somewhat tautological -- fact that encryption happens on both ends and any intermediates do not have access to the keys, not to the specific math behind it. 
Since the keys have to be available to both ends, public key cryptography is usually the preferred method, because the private key for each end is not transmitted to the other end, and therefore cannot be intercepted unless either end is compromised. 

Also wether it is factoring-based (i.e. RSA algorithm), or elliptic-curve based refers to the method of getting the function leading to the encrypted message, which is difficult to reverse.

The basis of cryptography is quite algebra-heavy, depending on your background; that said one introductory book is  Hoffstein's: springer.com/us/book/9781493917105

Either way it's probably easier than going through the original literature on the topic. Otherwise, you may want to start with a more conceptual primer, here's one

https://blogs.msdn.microsoft.com/plankytronixx/2010/10/22/crypto-primer-understanding-encryption-publicprivate-key-signatures-and-certificates/

https://arstechnica.com/security/2013/10/a-relatively-easy-to-understand-primer-on-elliptic-curve-cryptography/

hope that helped.