Show HN: Integer Decompiler – Get the shortest program generating a given number

A project I've been working on every once in a while over the last ~10 years.

Given an integer, this tool shows its shortest "description" - the shortest program that computes it, written in a simple stack-based language. The idea is that short programs generating certain data equal insights about that data. It is not a new idea [0], but I couldn't find any implementations, so I decided to start with the simplest case: programs that output a single positive integer.

This can be useful when doing a computation and getting some "random" large number, like 1047552, as a result. The Integer Decompiler will tell you that 1047552 is not "random": it is 2**20 - 2**10 (more precisely, the shortest program outputting 1047552 does it by computing 2**20 - 2**10). This can allow better understanding of the problem: If the input was N=10, maybe the general formula is (2**(2*N) - 2**N).

[0] https://en.wikipedia.org/wiki/Minimum_description_length

1 points mdl_principle 3 years ago 2 comments

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton