I am curious if there are applications for something along the following lines, and how does it compare to existing methods? (Keep in mind that I know almost nothing about compression.)
Is there a reason to use sequence indices to compress data with patterns?
Examples
A trivial example would be a bit sequence starting with $1$ followed by a lot of $0$'s. This can be compressed from $2^n$ to $n$ by providing $n$ (index of the sequence "$2^n$"). This is trivially "too regular" to be useful, but it illustrates the idea.
Another example is, what if our bit sequence is a prime number? We know $p_n\approx n\log n$, so for example, given a prime of size $100$ GB (which is $8\cdot 10^{11}$ bits), if we instead provide its index, it would be compressed down roughly (solve $n \log n = 8\cdot 10^{11} $) to a number of size $4.13$ GB ? This exact example is perhaps too optimistic and too computationally hard to be useful, but it illustrates the idea once more.
Question
My question is, could there be a practically useful subset of sequences such that providing (sequence rule, index) instead of the number itself, would be efficient enough to be useful?
Would it even be possible to find a subset of "useful" data with "good enough" patterns to match terms of the sequences often enough?
Or, are there similarly working ideas out there?
Additionally, we might also provide a small offset, so (sequence rule, index, offset). This way for example, we can use the second example (prime numbers) if our sequence of bits is close to a prime number.