The m has to be between 0 and n-1, so the choice of m cannot be greater than n = p.q. Given plaintext m, public key e, encrypt m
Getting started, and introduction to RSA maths This learning tool presents how the Euclidean algorithm is used to find the gcd of two values, and to use extended Euclidean algorithm to find private key d. This tool will also be used as a refresher if I have forgotten how to calculate the RSA mathematics.
I wrote this script to teach myself on how to do RSA key generation (public key e and private key d), and how to encrypt and decrypt message mathematically.