I'm assuming the known primes would be in a database somewhere, and you could just use the indices, instead of some 512-digit number.
The process could be repeatable if 'a' was too big, theoretically enabling some extreme compression.
You'd need a way to handle extremely large ints, and in the few minutes I thought about it, you'd need at least twice the original file size available for compression/decompression.
I'm also pretty sure my idea is full of shit, but there are more details than in the article.