I'm aware that an algorithm that compresses every input doesn't exist (by the pigeonhole principle), however I tend to think about the problem sometimes and I came up with a (flawed, but why?) idea:
Suppose a file, or whatever it is that will be compressed. It can be represented with a number (we can actually invert the bits if the first binary digit of the file is one, and indicate whether we've flipped them or not, since computers work based on bytes, but that is detail) if we treat its bits as the base-2 representation of the number. Let such number be $n$.
It is computationally cheap ($O(\log{n})$) to find $floor(sqrt($n$))$.
We find $x_1 = floor(sqrt(n))$ and then take $y_1 = n - (floor(sqrt(n)))^2$. Then we do it again (this time, taking $floor(sqrt(y_1))$, where $y_1$ is the new value we obtained from the subtraction) and again until we have expressed $n$ as a sum of perfect squares, following that rule. Something like $x_1^2 + x_2^2 + ... + x_w^2$. We know, since we are at least dividing $n$ by two every step, that $w$ is of order $\log(n)$.
Noting that $x^2$ is equal to the sum of the first x odd numbers, we then express the squares, logically, to better understand the idea, as shown in the image:
The first line of the image represents the first square obtained from the process, the second line represent the second square obtained and so on. A random representation was chosen just to illustrate, but imagine the polygon as being the representation of any number. If we are able to precisely determine the polygon for a given $n$, we know $n$. Notice once we represent the numbers this way, we can group them in the following order:
The first red rectangle is the product of ($1+3+5$) = $(3^2)$ by however many lines the rectangle occupies. The second one is the product of ($(1+3+5+7+9+11)-(1+3+5)$) = $(6^2 - 3^2)$ by however many lines the rectangle occupies, and so on. The green square, which represents the one (may or may not exist in a given $n$ representation), is a special case.
Abstracting a bit more, given the following image:
If we know the purple points, we know the figure and, thus, we know $n$. In order to specify the purple points, we need to specify the distances in blue and the distances in brown. The vertical side of the polygon is of order $O(\log(n))$, since it is related to how many initial squares we had. The vertical side, on the other hand, is of order $O(sqrt(n))$, since they're related to $sqrt(n)$ (the representation of the square root).
What is particularly interesting, however, is that by specifying this first purple point, we are able to, in fact, infer all the other purple points and all the other brown vertical distances, provided we have registered the purple horizontal distances. To see this, imagine we are in the first brown point. We then see the next horizontal distance and are able to know exactly the next vertical distance (and consequently the brown point); we know how the pattern continues. We know how many lines we have total, since we are able to "see" the first red rectangle (and the green square if we specified it or not). We further know that the vertical distance between one point and the next point is always one, due to the fact that no two lines are equal (since they represent different squares). Point is, given the basic representation of the first vertical distance, we know all the vertical distances.
Maybe it is possible to represent the first brown distance with fewer bytes increasing its exponent or tweaking it somehow. I had an idea in mind but I just realized it's flawed. And the blue distances would need to be represented (they can be taken as a new $n$ and all the process repeated again).
Also, it's worth noting that the the horizontal distances relate to the previous horizontal distances because when we made the squares for $n$, the subtraction $n - floor(sqrt(n))^2$ is taken as the new $n$, and is represented as $x_m$, but $n - floor(sqrt(n))^2$ is always between $1$ and $2floor(sqrt(n)) - 2$ (if it were 0, it would be a perfect square, so great; if it were $2floor(sqrt(n)) - 1$, it could be integrated into $x_m^2$, so it can never be that (nor greater than that)).
Anyhow, I am sorry if the explanation is a bit messy. I just had to share my ideas and ask whether it's worth implementing something related to the idea above in order to test it, or it is a waste of time. That is, if the approach is good (most likely, perhaps impossibly likely, as said in the beginning, to not be the case). Thanks! Edit: it is proven to be impossible to compress every input, what I meant to ask was whether this approach would be useful for most of the inputs or thoughts on the approach in general and why it doesn't work.