1. Take illegal number
2. GZip it, or at least store it in a format that discards trailing null bytes.
3. Multiply it by a power of 256
Every power of 256 adds a zero to the end, in the same way that multiplying 5x10=50, 5x100=500, etc.
4. Add a an integer and check primality; repeat.
So if the illegal number was 12345 your could have an illegal prime 1234500000071 represented by (12345x256^8+71).
The only reason you’d want to do this is because people actually share seemingly random prime numbers online. There’s no legal reason to share the DeCSS encryption code, but a prime number with a length of 2000 is “interesting” enough to avoid legal issue.