Key pair generation

/* pick 2 distinct primes */
p:2^1279-1;
q:2^2203-1;
n:p*q;

/* pick encoding key to publish along with n */
e:1234786123;
/* check that e is a unit */
gcd(e,(p-1)*(q-1));

/* secret decoding key */
d:inv_mod(e,(p-1)*(q-1));

Encoding

/* message */
m:404;

/* coded c=m^e mod n */
c:power_mod(m,e,n);

Decoding

power_mod(c,d,n);