We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

Hard

From Esolang
Jump to navigation Jump to search

Hard is an esoteric programming language by User:AndrewBayly in which every bit of the source code is XORed against a specific bit of the binary expansion of π. Specifically, the bit at source position N (1-indexed) is XORed against the (N!)-th bit of π. Because N! grows much faster than N, the amount of computation required to produce or recover even a single character of source is, for all but the very first few bits, larger than any computation that will ever actually be carried out. Hard is theoretically well-defined, Turing complete, and for practical purposes cannot be written, encoded, or decoded.

It is the fourth member of an "asymmetry" quartet of languages by the same author, each exploring a different axis of one-sided computational difficulty:

  • PrimeScript — hard to execute (decoding requires finding a large prime factor)
  • Square — hard to execute (decoding requires a permutation search to reassemble blocks)
  • Trapdoor — hard to write (a valid program must satisfy a modular constraint)
  • Hard — hard to write and hard to execute (both directions require computing π at factorial-indexed positions)

Computational class

Hard's host language, tinylisp, is Turing complete, and the XOR encoding is a bijection on bitstrings, so Hard is Turing complete in the fully formal sense: for every computable function there exists a Hard program (i.e. an encoded bitstring) that computes it. No such program of non-trivial length can ever be produced or executed, however, since doing so requires computing bits of π at positions that exceed the number of computational steps physically available in the observable universe. Hard is therefore Turing complete in exactly the sense that is least useful: it can compute anything, and will compute nothing.

External resources

  • Reference implementation and interactive demo — a browser-based (HTML/JS) implementation that performs the real BBP computation live (validated against known digits of π), resolves the first several bits of a program for real, and then honestly extrapolates and gives up once the term count exceeds what a browser can finish in reasonable time.

See also