How would I go about doing this, for larger values of n? e.g with 3 figures, where the primes cannot be so easily found.

The idea is that for large n factoring it should be hard, otherwise you don't
have much of a cypher.

However three figures is not large enough to make this difficult and it can still
be done with a bit of persistence. In fact with a modern desk top PC and a C
compiler I would have thought 10 digits is still a piece of cake, and 12 if you
don't mind waiting a bit.

n should always be the product of two similarly sized primes, as one of
the must be < sqrt(n), so with three digits for n that leaves you with one
of the primes is <32 which is not a lot of work to check, just divide n by
each of the primes <32 until you find one that divides n, and do the division
to find the other prime factor.