Efficient compression of simple binary data
Sure, of course there are algorithms.  Here is my algorithm:


First, check if the file contains ordered binary numbers from $0$ to $2^n-1$, for some $n$.  If so, write out a 0 bit followed by $n$ one bits followed by a 0 bit.
If not, write out a 1 bit, then write out the 7z-compression of the file.


This is extremely efficient for files of that particular structure.

The point is: there is no free lunch in data compression.  You might be able to build a compression algorithm that compresses one type of file well, at the cost of compressing others worse.  But, if you know a priori something about the nature of the files you will be compressing, you can optimize your algorithm for that particular type of file.

The area is "data compression".  See our data-compression tag, and read textbooks on data compression.