How to generalize Tupper's self-referential formula?

254 Views Asked by At

How do I generalilze Tupper's self-referential formula so that it can graph arbitrarily big images, and not just $17 \times 106$ pixels ones?

$${1\over 2} < \left\lfloor \mathrm{mod}\left(\left\lfloor {y \over 17} \right\rfloor 2^{-17 \lfloor x \rfloor - \mathrm{mod}(\lfloor y\rfloor, 17)},2\right)\right\rfloor$$

I imagine I have to replace $17$ with some arbitrary number $n$. Will that do the trick? What about $106$? Where does it come from?

1

There are 1 best solutions below

0
On

If you haven't already gone through it, then an excellent explanation is at https://shreevatsa.wordpress.com/2011/04/12/how-does-tuppers-self-referential-formula-work/

The author explains in detail how the formula works and also helps in understanding how to generalize it.

To answer your question, I will briefly describe how to generalize. For knowing the why behind it, I encourage you to go through the previously linked article.

Suppose you have an image (bitmap) of arbitrary height and width and you want to find an inequality (that looks similar to tupper's formula) and the value of N for that image such that when you make a graph of that inequality with that particular value of N you get back your image. Then:

  1. if the height of your image (i.e. the length along the vertical Y direction) is other than 17 pixels (say 45 pixels) then just replace the 17 in the original formula with 45. Also don't forget to do so in the range of y (i.e. the new range of y should be N < y < N + 45)
  2. if the width of your image (i.e. the length along the horizontal X direction) is other than 106 pixels (say 192 pixels) the just replace 106 with 192 in the range of x (i.e. the new range of x should be 0 < x < 192)
  3. if both width and height of image are other than 106 and 17 respectively then do both the replacements mentioned above.

Doing the above steps will give you the inequality (which will look identical to original formula if the height of your image is exactly 17 pixels) to be plotted and the exact range of x in which to plot it. However, the exact range of y is still not known as we don't know the value of N (since it depends on what your image is).

The method to find the value of N is well explained in the article I have linked above. Briefly, the method first finds the value of N in binary (i.e. in base 2) from the image and the converts it into decimal (i.e. base 10). To find the binary N from the image it involves traversing your image (bitmap) column wise i.e. going from down to up and then from left to right starting from the bottom-left corner of the image. The bottom-left corner maps to the rightmost bit in the binary N and so on. Whenever a pixel is black the bit corresponding to the pixel is set to 1 otherwise it is kept to 0.

Once all the above mentioned things are completed you will have an inequality which when graphed in the range of x and y that you had found, will give the image you had desired.

For better visualization, I have created a python script which is available on github and which allows you to draw any two coloured pixelated picture on a grid of height 17 pixels and width 106 pixels which then gives you the value of N corresponding to that picture so for example if you have the following picture playing cards suites pixelated
then the value of N corresponding to this picture which I found using the above linked script is
573664048802431285558384669364352925059638745045637318771330283263689925623512983966825565546953441049160288866400662368999420358297824194432021809665303159472762426112693175725741721715844365367846948865802115889305652072084761535561585075425406795419160445636331380266234319267174478760508576590406346155428633201020192455643408277590918394462619142989337244768646480332610252190311941581014022074814334170654936502928583356066933856116345126839941691180729761792

If you plot Tupper's self referential formula on 0 < x < 106 and N < y < N + 17 with the above mentioned value of N, you will get the image displayed above.