Tupper's self-referential formula

Arjen Markus (24 april 2015) I had never heard of this formula before it turned up in the chatroom. aspect mentioned this post , which contains a neat implementation in Tcl/Tk. More can be found on the Wikipedia page - of course with all the references you need to really understand it.

The script below is taken from the reddit page, as posted by "kramk".

#!/usr/bin/env tclsh
package require Tk
package require Img
#fconfigure stdout -buffering none

namespace eval tupper {
    proc image {im w h k expr} {
        for {set i 0} {$i < $w} {incr i} {
            for {set j 0} {$j < $h} {incr j} {
                set x $i
                set y [expr {$j + $k}]
                #puts -nonewline [expr $expr]

                if $expr {
                    $im put [list #00f] -to [expr {$w - $i}] $j
                }
                yieldto after 2 [info coroutine]
            }
            #puts ""
        }
        return $im
    }
}

# set expr { ($y / 17) * 2 ** (-17 * $x - $y % 17) % 2 }
#  int (2 ** -x) is 0, so use >> to preserve bigint form
set expr { (($y / 17) >> (17 * $x + ($y % 17))) & 1 }

set k 960939379918958884971672962127852754715004339660129306651505519271702802395266424689642842174350718121267153782770623355993237280874144307891325963941337723487857735749823926629715517173716995165232890538221612403238855866184013235585136048828693337902491454229288667081096184496091705183454067827731551705405381627380967602565625016981482083418783163849115590225610003652351370343874461848378737238198224849863465033159410054974700593138339226497249461751545728366702369745461014655997933798537483143786841806593422227898388722980000748404719

set w 106
set h 17

set im [::image create photo -width $w -height $h]

pack [label .l0 -text "Tupper's self-referential formula"] -expand yes -fill x
pack [label .l1 -text $expr] -expand yes -fill x
pack [label .l2 -image $im] -expand yes -fill x
pack [button .exit -command exit -text "Close"]

coroutine main tupper::image $im $w $h $k $expr