Skip to content

Instantly share code, notes, and snippets.

@purplejacket
Last active November 23, 2021 01:28
Show Gist options
  • Save purplejacket/1871131 to your computer and use it in GitHub Desktop.
Save purplejacket/1871131 to your computer and use it in GitHub Desktop.
Fermat's last theorem - halting problem
// Theory of computation: halting problem: will the following program ever halt?
outer_loop:
for (let bound=3; ; bound++)
for (let n=3; n<=bound; n++)
for (let a=1; a<=bound; a++)
for (let b=1; b<=bound; b++)
for (let c=1; c<=bound; c++)
if (a**n + b**n == c**n)
break outer_loop;
/*
c.f.
http://mathworld.wolfram.com/HaltingProblem.html
http://en.wikipedia.org/wiki/Halting_problem
http://www.netfunny.com/rhf/jokes/new89/halting.760.html
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment