You will need:
Lay the magnet on the table, stick the pencil inside the ring, finished!
If you use natural wood pencils you won't have the problem of rubbing the paint off.
This doesn't work equally well for all brands of pencils as different manufacturers make pencils of different diameters.
If necessary, you may have to file down the pencil end for the ring magnet to fit.