Compare commits

...

18 Commits

Author SHA1 Message Date
github-actions[bot]
05edde6c33 docs: auto-update README.md via pytudes.py 2026-06-17 21:51:48 +00:00
Peter Norvig
ceb79dd67f Add tutorial on Lisp interpreter to pytudes 2026-06-17 14:51:26 -07:00
Peter Norvig
76e35e2cd3 Add files via upload 2026-06-17 14:19:39 -07:00
Peter Norvig
a2f6772b66 Fix typo in colab link 2026-06-11 13:12:06 -07:00
Peter Norvig
8fbf7b4a19 Fix typo in README.md for 'colab' 2026-06-11 13:11:00 -07:00
github-actions[bot]
8a5a7fd4f8 docs: auto-update README.md via pytudes.py 2026-06-11 20:09:29 +00:00
Peter Norvig
af3fb185ef Add files via upload 2026-06-11 13:09:15 -07:00
Peter Norvig
3db6443929 Delete py/README.md 2026-06-11 13:00:45 -07:00
github-actions[bot]
c9c763f97f docs: auto-update README.md via pytudes.py 2026-06-11 19:58:57 +00:00
Peter Norvig
9ec85ae31e Add files via upload 2026-06-11 12:58:37 -07:00
Peter Norvig
59007a6145 Convert year comparison to integer for accuracy 2026-06-11 12:45:06 -07:00
Peter Norvig
84616c6a9b Fix formatting in pytudes.py 2026-06-11 12:37:05 -07:00
Peter Norvig
2d8286014f Add environment variable for Node.js version
Set environment variable to force Node.js version 24 for actions.
2026-06-11 12:36:26 -07:00
Peter Norvig
10e2880c9b Add new programming example for approximating Pi 2026-06-11 12:32:38 -07:00
Peter Norvig
dba5328b8a Add files via upload 2026-06-11 12:27:51 -07:00
Peter Norvig
57fc06e78c Update concordance description formatting in Snobol notebook 2026-06-11 11:23:34 -07:00
Peter Norvig
cbe3c7a9b3 Merge pull request #146 from JEHoctor/patch-1
Fix return type and docstring in guess_row function
2026-06-03 13:46:17 -07:00
James Hoctor
8e4b98eba4 Fix return type and docstring in guess_row function 2026-03-11 14:58:31 -04:00
7 changed files with 908 additions and 460 deletions

View File

@@ -5,6 +5,9 @@ on:
paths:
- 'py/pytudes.py'
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
jobs:
build-and-update:
runs-on: ubuntu-latest

242
README.md
View File

@@ -15,155 +15,149 @@ To continue the musical analogy, some people think of programming like [Spotify]
# Index of Jupyter (IPython) Notebooks
For each notebook you can hover on the title to see a description, or click the title to view on github, or click one of the letters in the left column to launch the notebook on
[**C**olab](https://colab.research.google.com),
[**D**eepnote](https://deepnote.com),
[**M**ybinder](https://mybinder.org),
[**S**agemaker](https://studiolab.sagemaker.aws/), or
[**N**BViewer](https://nbviewer.jupyter.org/).
For each notebook you can hover on the title to see a description, or click the title to view on github, or click one of the letters in the left column to open the notebook on
[**co**lab](https://colab.research.google.com) or
[**nb**viewer](https://nbviewer.jupyter.org/).
|Run|Year|New|
|Open|Year|New|
|---|---|---|
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/clvr.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2Fclvr.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2Fclvr.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/clvr.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/clvr.ipynb) | 2026 | <a href="ipynb/clvr.ipynb" title="Guess famous phrases from letter shapes. Beginner level.">Did you solve it? R y clvr ngh t rd ths sntnc?</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Euler3.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FEuler3.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FEuler3.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Euler3.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Euler3.ipynb) | 2026 | <a href="ipynb/Euler3.ipynb" title="Find the largest prime factor of a number">Project Euler #3: Largest prime factor</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/TruncatablePrimes.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FTruncatablePrimes.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FTruncatablePrimes.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/TruncatablePrimes.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/TruncatablePrimes.ipynb) | 2026 | <a href="ipynb/TruncatablePrimes.ipynb" title="Prime numbers where you can remove digits and still get primes.">Truncatable Primes</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Advent-2025.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FAdvent-2025.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FAdvent-2025.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Advent-2025.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Advent-2025.ipynb) | 2025 | <a href="ipynb/Advent-2025.ipynb" title="Puzzle site with a coding puzzle for 12 days of Christmas, December 2025">Advent of Code 2025</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Advent-2025-AI.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FAdvent-2025-AI.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FAdvent-2025-AI.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Advent-2025-AI.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Advent-2025-AI.ipynb) | 2025 | <a href="ipynb/Advent-2025-AI.ipynb" title="Using large language coding models to solve AoC puzzles">Advent of Code 2025: AI LLM Edition</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Advent-2024.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FAdvent-2024.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FAdvent-2024.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Advent-2024.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Advent-2024.ipynb) | 2024 | <a href="ipynb/Advent-2024.ipynb" title="Puzzle site with a coding puzzle each day of Advent, December 2024">Advent of Code 2024</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Paint.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FPaint.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FPaint.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Paint.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Paint.ipynb) | 2024 | <a href="ipynb/Paint.ipynb" title="What is the average cluster size of a random grid of colored squares?">Counting Cluster Sizes in Paint by Numbers</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/CherylMind.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FCherylMind.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FCherylMind.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/CherylMind.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/CherylMind.ipynb) | 2024 | <a href="ipynb/CherylMind.ipynb" title="Do LLMs have enough theory of mind to solve the Cheryl's Birthday puzzle?">LLMs, Theory of Mind, and Cheryl's Birthday</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/NumberBracelets.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FNumberBracelets.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FNumberBracelets.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/NumberBracelets.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/NumberBracelets.ipynb) | 2024 | <a href="ipynb/NumberBracelets.ipynb" title="A game involving numbered beads on a circular bracelet.">Number Bracelets Game</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Overtime.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FOvertime.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FOvertime.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Overtime.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Overtime.ipynb) | 2024 | <a href="ipynb/Overtime.ipynb" title="In American Football, which team has the advantage in overtime?">Overtime in American Football</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Stubborn.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FStubborn.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FStubborn.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Stubborn.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Stubborn.ipynb) | 2024 | <a href="ipynb/Stubborn.ipynb" title="Any number ending in 5 has a square that also ends in 5. What other endings are like this?">Stubborn number endings</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Triplets.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FTriplets.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FTriplets.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Triplets.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Triplets.ipynb) | 2024 | <a href="ipynb/Triplets.ipynb" title="LLMs do better at producing a program to solve this puzzle than they do at solving it directly">The Languages of English, Math, and Programming</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/lispy.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/lispy.ipynb) | 2026 | <a href="ipynb/lispy.ipynb" title="Tutorial on interpreters.">(How to Write a (Lisp) Interpreter (in Python))</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/RationalPi.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/RationalPi.ipynb) | 2026 | <a href="ipynb/RationalPi.ipynb" title="Using continued fractions to find fractions (like 22/7) that are close to pi.">Approximating Pi with a Fraction</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/clvr.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/clvr.ipynb) | 2026 | <a href="ipynb/clvr.ipynb" title="Guess famous phrases from letter shapes. Beginner level.">Did you solve it? R y clvr ngh t rd ths sntnc?</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Euler3.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Euler3.ipynb) | 2026 | <a href="ipynb/Euler3.ipynb" title="Find the largest prime factor of a number">Project Euler #3: Largest prime factor</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/TruncatablePrimes.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/TruncatablePrimes.ipynb) | 2026 | <a href="ipynb/TruncatablePrimes.ipynb" title="Prime numbers where you can remove digits and still get primes.">Truncatable Primes</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Advent-2025.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Advent-2025.ipynb) | 2025 | <a href="ipynb/Advent-2025.ipynb" title="Puzzle site with a coding puzzle for 12 days of Christmas, December 2025">Advent of Code 2025</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Advent-2025-AI.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Advent-2025-AI.ipynb) | 2025 | <a href="ipynb/Advent-2025-AI.ipynb" title="Using large language coding models to solve AoC puzzles">Advent of Code 2025: AI LLM Edition</a> |
|Run|Year|Programming Examples|
|Open|Year|Programming Examples|
|---|---|---|
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/AlphaCode.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FAlphaCode.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FAlphaCode.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/AlphaCode.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/AlphaCode.ipynb) | 2022 | <a href="ipynb/AlphaCode.ipynb" title="Analysis of AlphaCode's automated solution to a coding problem">AlphaCode Automated Programming</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Babylonian%20digits.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FBabylonian%20digits.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FBabylonian%20digits.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Babylonian%20digits.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Babylonian%20digits.ipynb) | 2022 | <a href="ipynb/Babylonian%20digits.ipynb" title="Translating between Babylonian and traditional number systems.">The Babylonian Number System</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Beal.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FBeal.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FBeal.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Beal.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Beal.ipynb) | 2018 | <a href="ipynb/Beal.ipynb" title="A search for counterexamples to Beal's Conjecture">Beal's Conjecture Revisited</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Bike-Stats.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FBike-Stats.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FBike-Stats.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Bike-Stats.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Bike-Stats.ipynb) | 2020 | <a href="ipynb/Bike-Stats.ipynb" title="Visualizing statistics about bike routes">Bicycling Statistics</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Cant-Stop.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FCant-Stop.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FCant-Stop.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Cant-Stop.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Cant-Stop.ipynb) | 2018 | <a href="ipynb/Cant-Stop.ipynb" title="Optimal play in a dice board game">Can't Stop</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Sierpinski.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FSierpinski.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FSierpinski.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Sierpinski.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Sierpinski.ipynb) | 2019 | <a href="ipynb/Sierpinski.ipynb" title="A surprising appearance of the Sierpinski triangle in a random walk">Chaos with Triangles</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Life.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FLife.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FLife.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Life.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Life.ipynb) | 2017 | <a href="ipynb/Life.ipynb" title="The cellular automata zero-player game">Conway's Game of Life</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Maze.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FMaze.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FMaze.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Maze.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Maze.ipynb) | 2020 | <a href="ipynb/Maze.ipynb" title="Make a maze by generating a random tree superimposed on a grid and solve it">Generating and Solving Mazes</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Triplets.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FTriplets.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FTriplets.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Triplets.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Triplets.ipynb) | 2024 | <a href="ipynb/Triplets.ipynb" title="LLMs do better at producing a program to solve this puzzle than they do at solving it directly">The Languages of English, Math, and Programming</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Konane.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FKonane.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FKonane.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Konane.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Konane.ipynb) | 2021 | <a href="ipynb/Konane.ipynb" title="Solving the game of Konane (Hawaiian checkers).">Mel's Konane Board</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/PhotoFocalLengths.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FPhotoFocalLengths.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FPhotoFocalLengths.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/PhotoFocalLengths.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/PhotoFocalLengths.ipynb) | 2020 | <a href="ipynb/PhotoFocalLengths.ipynb" title="Generate charts of what focal lengths were used on a photo trip">Photo Focal Lengths</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Pickleball.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FPickleball.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FPickleball.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Pickleball.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Pickleball.ipynb) | 2018 | <a href="ipynb/Pickleball.ipynb" title="Scheduling a doubles tournament fairly and efficiently">Pickleball Tournament</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Project%20Euler%20Utils.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FProject%20Euler%20Utils.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FProject%20Euler%20Utils.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Project%20Euler%20Utils.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Project%20Euler%20Utils.ipynb) | 2017 | <a href="ipynb/Project%20Euler%20Utils.ipynb" title="My utility functions for the Project Euler problems, including `Primes` and `Factors`">Project Euler Utilities</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Menu.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FMenu.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FMenu.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Menu.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Menu.ipynb) | 2022 | <a href="ipynb/Menu.ipynb" title="Efficiently Selecting Names from a Menu, by typing characters and arrows">Selecting Names from a Menu</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Electoral%20Votes.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FElectoral%20Votes.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FElectoral%20Votes.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Electoral%20Votes.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Electoral%20Votes.ipynb) | 2020 | <a href="ipynb/Electoral%20Votes.ipynb" title="How many electoral votes would Trump get if he wins the state where he has positive net approval?">Tracking Polls: Electoral Votes</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/AlphaCode.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/AlphaCode.ipynb) | 2022 | <a href="ipynb/AlphaCode.ipynb" title="Analysis of AlphaCode's automated solution to a coding problem">AlphaCode Automated Programming</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/RationalPi.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/RationalPi.ipynb) | 2026 | <a href="ipynb/RationalPi.ipynb" title="Using continued fractions to find fractions (like 22/7) that are close to pi.">Approximating Pi with a Fraction</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Babylonian%20digits.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Babylonian%20digits.ipynb) | 2022 | <a href="ipynb/Babylonian%20digits.ipynb" title="Translating between Babylonian and traditional number systems.">The Babylonian Number System</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Beal.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Beal.ipynb) | 2018 | <a href="ipynb/Beal.ipynb" title="A search for counterexamples to Beal's Conjecture">Beal's Conjecture Revisited</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Bike-Stats.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Bike-Stats.ipynb) | 2020 | <a href="ipynb/Bike-Stats.ipynb" title="Visualizing statistics about bike routes">Bicycling Statistics</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Cant-Stop.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Cant-Stop.ipynb) | 2018 | <a href="ipynb/Cant-Stop.ipynb" title="Optimal play in a dice board game">Can't Stop</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Sierpinski.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Sierpinski.ipynb) | 2019 | <a href="ipynb/Sierpinski.ipynb" title="A surprising appearance of the Sierpinski triangle in a random walk">Chaos with Triangles</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Life.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Life.ipynb) | 2017 | <a href="ipynb/Life.ipynb" title="The cellular automata zero-player game">Conway's Game of Life</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Maze.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Maze.ipynb) | 2020 | <a href="ipynb/Maze.ipynb" title="Make a maze by generating a random tree superimposed on a grid and solve it">Generating and Solving Mazes</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Triplets.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Triplets.ipynb) | 2024 | <a href="ipynb/Triplets.ipynb" title="LLMs do better at producing a program to solve this puzzle than they do at solving it directly">The Languages of English, Math, and Programming</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Konane.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Konane.ipynb) | 2021 | <a href="ipynb/Konane.ipynb" title="Solving the game of Konane (Hawaiian checkers).">Mel's Konane Board</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/PhotoFocalLengths.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/PhotoFocalLengths.ipynb) | 2020 | <a href="ipynb/PhotoFocalLengths.ipynb" title="Generate charts of what focal lengths were used on a photo trip">Photo Focal Lengths</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Pickleball.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Pickleball.ipynb) | 2018 | <a href="ipynb/Pickleball.ipynb" title="Scheduling a doubles tournament fairly and efficiently">Pickleball Tournament</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Project%20Euler%20Utils.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Project%20Euler%20Utils.ipynb) | 2017 | <a href="ipynb/Project%20Euler%20Utils.ipynb" title="My utility functions for the Project Euler problems, including `Primes` and `Factors`">Project Euler Utilities</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Menu.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Menu.ipynb) | 2022 | <a href="ipynb/Menu.ipynb" title="Efficiently Selecting Names from a Menu, by typing characters and arrows">Selecting Names from a Menu</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Electoral%20Votes.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Electoral%20Votes.ipynb) | 2020 | <a href="ipynb/Electoral%20Votes.ipynb" title="How many electoral votes would Trump get if he wins the state where he has positive net approval?">Tracking Polls: Electoral Votes</a> |
|Run|Year|Advent of Code|
|Open|Year|Advent of Code|
|---|---|---|
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Advent-2025-AI.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FAdvent-2025-AI.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FAdvent-2025-AI.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Advent-2025-AI.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Advent-2025-AI.ipynb) | 2025 | <a href="ipynb/Advent-2025-AI.ipynb" title="Using large language coding models to solve AoC puzzles">Advent of Code 2025: AI LLM Edition</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Advent-2025.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FAdvent-2025.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FAdvent-2025.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Advent-2025.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Advent-2025.ipynb) | 2025 | <a href="ipynb/Advent-2025.ipynb" title="Puzzle site with a coding puzzle for 12 days of Christmas, December 2025">Advent of Code 2025</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Advent-2024.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FAdvent-2024.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FAdvent-2024.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Advent-2024.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Advent-2024.ipynb) | 2024 | <a href="ipynb/Advent-2024.ipynb" title="Puzzle site with a coding puzzle each day of Advent, December 2024">Advent of Code 2024</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Advent-2023.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FAdvent-2023.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FAdvent-2023.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Advent-2023.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Advent-2023.ipynb) | 2023 | <a href="ipynb/Advent-2023.ipynb" title="Puzzle site with a coding puzzle each day of Advent, December 2023">Advent of Code 2023</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Advent-2022.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FAdvent-2022.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FAdvent-2022.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Advent-2022.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Advent-2022.ipynb) | 2022 | <a href="ipynb/Advent-2022.ipynb" title="Puzzle site with a coding puzzle each day of Advent, December 2022">Advent of Code 2022</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Advent-2021.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FAdvent-2021.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FAdvent-2021.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Advent-2021.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Advent-2021.ipynb) | 2021 | <a href="ipynb/Advent-2021.ipynb" title="Puzzle site with a coding puzzle each day of Advent, December 2021">Advent of Code 2021</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Advent-2020.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FAdvent-2020.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FAdvent-2020.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Advent-2020.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Advent-2020.ipynb) | 2020 | <a href="ipynb/Advent-2020.ipynb" title="Puzzle site with a coding puzzle each day of Advent, December 2020">Advent of Code 2020</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Advent-2018.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FAdvent-2018.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FAdvent-2018.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Advent-2018.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Advent-2018.ipynb) | 2018 | <a href="ipynb/Advent-2018.ipynb" title="Puzzle site with a coding puzzle each day of Advent, December 2018">Advent of Code 2018</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Advent-2017.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FAdvent-2017.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FAdvent-2017.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Advent-2017.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Advent-2017.ipynb) | 2017 | <a href="ipynb/Advent-2017.ipynb" title="Puzzle site with a coding puzzle each day of Advent, December 2017">Advent of Code 2017</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Advent-2016.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FAdvent-2016.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FAdvent-2016.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Advent-2016.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Advent-2016.ipynb) | 2016 | <a href="ipynb/Advent-2016.ipynb" title="Puzzle site with a coding puzzle each day of Advent, December 2016">Advent of Code 2016</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/AdventUtils.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FAdventUtils.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FAdventUtils.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/AdventUtils.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/AdventUtils.ipynb) | 2022 | <a href="ipynb/AdventUtils.ipynb" title="Utility functions for Advent of Code puzzles">Advent of Code Utilities</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Advent-2025-AI.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Advent-2025-AI.ipynb) | 2025 | <a href="ipynb/Advent-2025-AI.ipynb" title="Using large language coding models to solve AoC puzzles">Advent of Code 2025: AI LLM Edition</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Advent-2025.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Advent-2025.ipynb) | 2025 | <a href="ipynb/Advent-2025.ipynb" title="Puzzle site with a coding puzzle for 12 days of Christmas, December 2025">Advent of Code 2025</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Advent-2024.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Advent-2024.ipynb) | 2024 | <a href="ipynb/Advent-2024.ipynb" title="Puzzle site with a coding puzzle each day of Advent, December 2024">Advent of Code 2024</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Advent-2023.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Advent-2023.ipynb) | 2023 | <a href="ipynb/Advent-2023.ipynb" title="Puzzle site with a coding puzzle each day of Advent, December 2023">Advent of Code 2023</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Advent-2022.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Advent-2022.ipynb) | 2022 | <a href="ipynb/Advent-2022.ipynb" title="Puzzle site with a coding puzzle each day of Advent, December 2022">Advent of Code 2022</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Advent-2021.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Advent-2021.ipynb) | 2021 | <a href="ipynb/Advent-2021.ipynb" title="Puzzle site with a coding puzzle each day of Advent, December 2021">Advent of Code 2021</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Advent-2020.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Advent-2020.ipynb) | 2020 | <a href="ipynb/Advent-2020.ipynb" title="Puzzle site with a coding puzzle each day of Advent, December 2020">Advent of Code 2020</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Advent-2018.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Advent-2018.ipynb) | 2018 | <a href="ipynb/Advent-2018.ipynb" title="Puzzle site with a coding puzzle each day of Advent, December 2018">Advent of Code 2018</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Advent-2017.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Advent-2017.ipynb) | 2017 | <a href="ipynb/Advent-2017.ipynb" title="Puzzle site with a coding puzzle each day of Advent, December 2017">Advent of Code 2017</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Advent-2016.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Advent-2016.ipynb) | 2016 | <a href="ipynb/Advent-2016.ipynb" title="Puzzle site with a coding puzzle each day of Advent, December 2016">Advent of Code 2016</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/AdventUtils.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/AdventUtils.ipynb) | 2022 | <a href="ipynb/AdventUtils.ipynb" title="Utility functions for Advent of Code puzzles">Advent of Code Utilities</a> |
|Run|Year|Probability and Uncertainty|
|Open|Year|Probability and Uncertainty|
|---|---|---|
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Goldberg.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FGoldberg.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FGoldberg.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Goldberg.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Goldberg.ipynb) | 2019 | <a href="ipynb/Goldberg.ipynb" title="A re-implementation in Python 3 of Yoav Goldberg's unreasonably effective character-level n-gram language model.">Effectiveness of Language Models</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Probability.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FProbability.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FProbability.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Probability.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Probability.ipynb) | 2018 | <a href="ipynb/Probability.ipynb" title="Code and examples of the basic principles of Probability Theory">A Concrete Introduction to Probability</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/ProbabilityParadox.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FProbabilityParadox.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FProbabilityParadox.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/ProbabilityParadox.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/ProbabilityParadox.ipynb) | 2016 | <a href="ipynb/ProbabilityParadox.ipynb" title="Some classic paradoxes in Probability Theory, and how to think about disagreements">Probability, Paradox, and the Reasonable Person Principle</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/ProbabilitySimulation.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FProbabilitySimulation.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FProbabilitySimulation.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/ProbabilitySimulation.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/ProbabilitySimulation.ipynb) | 2020 | <a href="ipynb/ProbabilitySimulation.ipynb" title="When the sample space is too complex, simulations can estimate probabilities">Estimating Probabilities with Simulations</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Diamonds.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FDiamonds.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FDiamonds.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Diamonds.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Diamonds.ipynb) | 2023 | <a href="ipynb/Diamonds.ipynb" title="Finding an optimal strategy for buying bags with unknown numbers of diamonds.">The Diamond Game: A Probability Puzzle</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Coin%20Flip.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FCoin%20Flip.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FCoin%20Flip.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Coin%20Flip.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Coin%20Flip.ipynb) | 2019 | <a href="ipynb/Coin%20Flip.ipynb" title="How to beat the Devil at his own game">The Devil and the Coin Flip Game</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Dice%20Baseball.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FDice%20Baseball.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FDice%20Baseball.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Dice%20Baseball.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Dice%20Baseball.ipynb) | 2020 | <a href="ipynb/Dice%20Baseball.ipynb" title="Simulating baseball games">Dice Baseball</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Economics.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FEconomics.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FEconomics.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Economics.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Economics.ipynb) | 2018 | <a href="ipynb/Economics.ipynb" title="A simulation of a simple economic game">Economics Simulation</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Overtime.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FOvertime.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FOvertime.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Overtime.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Overtime.ipynb) | 2024 | <a href="ipynb/Overtime.ipynb" title="In American Football, which team has the advantage in overtime?">Overtime in American Football</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/poker.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2Fpoker.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2Fpoker.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/poker.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/poker.ipynb) | 2012 | <a href="ipynb/poker.ipynb" title="How do we decide which poker hand wins? Several variants of poker are considered">Poker Hand Ranking</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/risk.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2Frisk.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2Frisk.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/risk.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/risk.ipynb) | 2020 | <a href="ipynb/risk.ipynb" title="Determining who is likely to win an interminably long game of Risk">The Unfinished Game .... of Risk</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/WWW.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FWWW.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FWWW.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/WWW.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/WWW.ipynb) | 2019 | <a href="ipynb/WWW.ipynb" title="Computing the probability of winning the NBA title, for my home town Warriors, or any other team">WWW: Who Will Win (NBA Title)?</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Goldberg.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Goldberg.ipynb) | 2019 | <a href="ipynb/Goldberg.ipynb" title="A re-implementation in Python 3 of Yoav Goldberg's unreasonably effective character-level n-gram language model.">Effectiveness of Language Models</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Probability.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Probability.ipynb) | 2018 | <a href="ipynb/Probability.ipynb" title="Code and examples of the basic principles of Probability Theory">A Concrete Introduction to Probability</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/ProbabilityParadox.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/ProbabilityParadox.ipynb) | 2016 | <a href="ipynb/ProbabilityParadox.ipynb" title="Some classic paradoxes in Probability Theory, and how to think about disagreements">Probability, Paradox, and the Reasonable Person Principle</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/ProbabilitySimulation.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/ProbabilitySimulation.ipynb) | 2020 | <a href="ipynb/ProbabilitySimulation.ipynb" title="When the sample space is too complex, simulations can estimate probabilities">Estimating Probabilities with Simulations</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Diamonds.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Diamonds.ipynb) | 2023 | <a href="ipynb/Diamonds.ipynb" title="Finding an optimal strategy for buying bags with unknown numbers of diamonds.">The Diamond Game: A Probability Puzzle</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Coin%20Flip.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Coin%20Flip.ipynb) | 2019 | <a href="ipynb/Coin%20Flip.ipynb" title="How to beat the Devil at his own game">The Devil and the Coin Flip Game</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Dice%20Baseball.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Dice%20Baseball.ipynb) | 2020 | <a href="ipynb/Dice%20Baseball.ipynb" title="Simulating baseball games">Dice Baseball</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Economics.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Economics.ipynb) | 2018 | <a href="ipynb/Economics.ipynb" title="A simulation of a simple economic game">Economics Simulation</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Overtime.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Overtime.ipynb) | 2024 | <a href="ipynb/Overtime.ipynb" title="In American Football, which team has the advantage in overtime?">Overtime in American Football</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/poker.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/poker.ipynb) | 2012 | <a href="ipynb/poker.ipynb" title="How do we decide which poker hand wins? Several variants of poker are considered">Poker Hand Ranking</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/risk.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/risk.ipynb) | 2020 | <a href="ipynb/risk.ipynb" title="Determining who is likely to win an interminably long game of Risk">The Unfinished Game .... of Risk</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/WWW.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/WWW.ipynb) | 2019 | <a href="ipynb/WWW.ipynb" title="Computing the probability of winning the NBA title, for my home town Warriors, or any other team">WWW: Who Will Win (NBA Title)?</a> |
|Run|Year|Logic and Number/Counting Puzzles|
|Open|Year|Logic and Number/Counting Puzzles|
|---|---|---|
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Paint.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FPaint.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FPaint.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Paint.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Paint.ipynb) | 2024 | <a href="ipynb/Paint.ipynb" title="What is the average cluster size of a random grid of colored squares?">Counting Cluster Sizes in Paint by Numbers</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Cryptarithmetic.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FCryptarithmetic.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FCryptarithmetic.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Cryptarithmetic.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Cryptarithmetic.ipynb) | 2014 | <a href="ipynb/Cryptarithmetic.ipynb" title="Substitute digits for letters and make NUM + BER = PLAY">Cryptarithmetic</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Euler's%20Conjecture.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FEuler's%20Conjecture.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FEuler's%20Conjecture.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Euler's%20Conjecture.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Euler's%20Conjecture.ipynb) | 2018 | <a href="ipynb/Euler's%20Conjecture.ipynb" title="Solving a 200-year-old puzzle by finding integers that satisfy a<sup>5</sup> + b<sup>5</sup> + c<sup>5</sup> + d<sup>5</sup> = e<sup>5</sup>">Euler's Sum of Powers Conjecture</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Countdown.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FCountdown.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FCountdown.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Countdown.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Countdown.ipynb) | 2020 | <a href="ipynb/Countdown.ipynb" title="Solving the equation 10 _ 9 _ 8 _ 7 _ 6 _ 5 _ 4 _ 3 _ 2 _ 1 = 2016. Originally from an Alex Bellos puzzle">Four 4s, Five 5s, and Countdowns</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/How%20To%20Count%20Things.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FHow%20To%20Count%20Things.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FHow%20To%20Count%20Things.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/How%20To%20Count%20Things.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/How%20To%20Count%20Things.ipynb) | 2020 | <a href="ipynb/How%20To%20Count%20Things.ipynb" title="Combinatorial math: how to count how many things there are, when there are a lot of them">How to Count Things</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/KenKen.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FKenKen.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FKenKen.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/KenKen.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/KenKen.ipynb) | 2021 | <a href="ipynb/KenKen.ipynb" title="A Sudoku-like puzzle, but with arithmetic.">KenKen (Sudoku-like Puzzle)</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/NumberBracelets.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FNumberBracelets.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FNumberBracelets.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/NumberBracelets.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/NumberBracelets.ipynb) | 2024 | <a href="ipynb/NumberBracelets.ipynb" title="A game involving numbered beads on a circular bracelet.">Number Bracelets Game</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Euler3.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FEuler3.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FEuler3.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Euler3.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Euler3.ipynb) | 2026 | <a href="ipynb/Euler3.ipynb" title="Find the largest prime factor of a number">Project Euler #3: Largest prime factor</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Socks.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FSocks.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FSocks.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Socks.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Socks.ipynb) | 2019 | <a href="ipynb/Socks.ipynb" title="What is the probability that you will be able to pair up socks as you randomly pull them out of the dryer?">Pairing Socks</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Sicherman%20Dice.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FSicherman%20Dice.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FSicherman%20Dice.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Sicherman%20Dice.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Sicherman%20Dice.ipynb) | 2018 | <a href="ipynb/Sicherman%20Dice.ipynb" title="Find a pair of dice that is like a regular pair of dice, only different">Sicherman Dice</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Golomb-Puzzle.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FGolomb-Puzzle.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FGolomb-Puzzle.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Golomb-Puzzle.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Golomb-Puzzle.ipynb) | 2014 | <a href="ipynb/Golomb-Puzzle.ipynb" title="A Puzzle involving placing rectangles of different sizes inside a square">Sol Golomb's Rectangle Puzzle</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Stubborn.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FStubborn.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FStubborn.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Stubborn.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Stubborn.ipynb) | 2024 | <a href="ipynb/Stubborn.ipynb" title="Any number ending in 5 has a square that also ends in 5. What other endings are like this?">Stubborn number endings</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/StarBattle.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FStarBattle.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FStarBattle.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/StarBattle.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/StarBattle.ipynb) | 2021 | <a href="ipynb/StarBattle.ipynb" title="Fill-in-the-grid puzzle similar to Sudoku">Star Battle (Sudoku-like Puzzle)</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Sudoku.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FSudoku.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FSudoku.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Sudoku.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Sudoku.ipynb) | 2006 | <a href="ipynb/Sudoku.ipynb" title="Classic fill-in-the-grid puzzle">Sudoku</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/SudokuJava.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FSudokuJava.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FSudokuJava.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/SudokuJava.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/SudokuJava.ipynb) | 2021 | <a href="ipynb/SudokuJava.ipynb" title="A version of the Sudoku solver using parallel threads and other optimizations">Sudoku: 200,000 puzzles/second in Java</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/SquareSum.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FSquareSum.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FSquareSum.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/SquareSum.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/SquareSum.ipynb) | 2020 | <a href="ipynb/SquareSum.ipynb" title="Place the numbers from 1 to n in a chain (or a circle) such that adjacent pairs sum to a perfect square">Square Sum Puzzle</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Cheryl.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FCheryl.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FCheryl.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Cheryl.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Cheryl.ipynb) | 2020 | <a href="ipynb/Cheryl.ipynb" title="Solving the *Cheryl's Birthday* logic puzzle">When is Cheryl's Birthday?</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Cheryl-and-Eve.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FCheryl-and-Eve.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FCheryl-and-Eve.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Cheryl-and-Eve.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Cheryl-and-Eve.ipynb) | 2015 | <a href="ipynb/Cheryl-and-Eve.ipynb" title="Inventing new puzzles in the Style of Cheryl's Birthday">When Cheryl Met Eve: A Birthday Story</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/CherylMind.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FCherylMind.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FCherylMind.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/CherylMind.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/CherylMind.ipynb) | 2024 | <a href="ipynb/CherylMind.ipynb" title="Do LLMs have enough theory of mind to solve the Cheryl's Birthday puzzle?">LLMs, Theory of Mind, and Cheryl's Birthday</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/xkcd1313.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2Fxkcd1313.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2Fxkcd1313.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/xkcd1313.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/xkcd1313.ipynb) | 2015 | <a href="ipynb/xkcd1313.ipynb" title="Find the smallest regular expression; inspired by Randall Munroe">xkcd 1313: Regex Golf</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/xkcd1313-part2.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2Fxkcd1313-part2.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2Fxkcd1313-part2.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/xkcd1313-part2.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/xkcd1313-part2.ipynb) | 2015 | <a href="ipynb/xkcd1313-part2.ipynb" title="Regex Golf: better, faster, funner (with Stefan Pochmann)">xkcd 1313: Regex Golf (Part 2: Infinite Problems)</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Paint.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Paint.ipynb) | 2024 | <a href="ipynb/Paint.ipynb" title="What is the average cluster size of a random grid of colored squares?">Counting Cluster Sizes in Paint by Numbers</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Cryptarithmetic.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Cryptarithmetic.ipynb) | 2014 | <a href="ipynb/Cryptarithmetic.ipynb" title="Substitute digits for letters and make NUM + BER = PLAY">Cryptarithmetic</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Euler's%20Conjecture.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Euler's%20Conjecture.ipynb) | 2018 | <a href="ipynb/Euler's%20Conjecture.ipynb" title="Solving a 200-year-old puzzle by finding integers that satisfy a<sup>5</sup> + b<sup>5</sup> + c<sup>5</sup> + d<sup>5</sup> = e<sup>5</sup>">Euler's Sum of Powers Conjecture</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Countdown.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Countdown.ipynb) | 2020 | <a href="ipynb/Countdown.ipynb" title="Solving the equation 10 _ 9 _ 8 _ 7 _ 6 _ 5 _ 4 _ 3 _ 2 _ 1 = 2016. Originally from an Alex Bellos puzzle">Four 4s, Five 5s, and Countdowns</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/How%20To%20Count%20Things.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/How%20To%20Count%20Things.ipynb) | 2020 | <a href="ipynb/How%20To%20Count%20Things.ipynb" title="Combinatorial math: how to count how many things there are, when there are a lot of them">How to Count Things</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/KenKen.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/KenKen.ipynb) | 2021 | <a href="ipynb/KenKen.ipynb" title="A Sudoku-like puzzle, but with arithmetic.">KenKen (Sudoku-like Puzzle)</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/NumberBracelets.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/NumberBracelets.ipynb) | 2024 | <a href="ipynb/NumberBracelets.ipynb" title="A game involving numbered beads on a circular bracelet.">Number Bracelets Game</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Euler3.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Euler3.ipynb) | 2026 | <a href="ipynb/Euler3.ipynb" title="Find the largest prime factor of a number">Project Euler #3: Largest prime factor</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Socks.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Socks.ipynb) | 2019 | <a href="ipynb/Socks.ipynb" title="What is the probability that you will be able to pair up socks as you randomly pull them out of the dryer?">Pairing Socks</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Sicherman%20Dice.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Sicherman%20Dice.ipynb) | 2018 | <a href="ipynb/Sicherman%20Dice.ipynb" title="Find a pair of dice that is like a regular pair of dice, only different">Sicherman Dice</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Golomb-Puzzle.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Golomb-Puzzle.ipynb) | 2014 | <a href="ipynb/Golomb-Puzzle.ipynb" title="A Puzzle involving placing rectangles of different sizes inside a square">Sol Golomb's Rectangle Puzzle</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Stubborn.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Stubborn.ipynb) | 2024 | <a href="ipynb/Stubborn.ipynb" title="Any number ending in 5 has a square that also ends in 5. What other endings are like this?">Stubborn number endings</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/StarBattle.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/StarBattle.ipynb) | 2021 | <a href="ipynb/StarBattle.ipynb" title="Fill-in-the-grid puzzle similar to Sudoku">Star Battle (Sudoku-like Puzzle)</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Sudoku.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Sudoku.ipynb) | 2006 | <a href="ipynb/Sudoku.ipynb" title="Classic fill-in-the-grid puzzle">Sudoku</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/SudokuJava.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/SudokuJava.ipynb) | 2021 | <a href="ipynb/SudokuJava.ipynb" title="A version of the Sudoku solver using parallel threads and other optimizations">Sudoku: 200,000 puzzles/second in Java</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/SquareSum.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/SquareSum.ipynb) | 2020 | <a href="ipynb/SquareSum.ipynb" title="Place the numbers from 1 to n in a chain (or a circle) such that adjacent pairs sum to a perfect square">Square Sum Puzzle</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Cheryl.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Cheryl.ipynb) | 2020 | <a href="ipynb/Cheryl.ipynb" title="Solving the *Cheryl's Birthday* logic puzzle">When is Cheryl's Birthday?</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Cheryl-and-Eve.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Cheryl-and-Eve.ipynb) | 2015 | <a href="ipynb/Cheryl-and-Eve.ipynb" title="Inventing new puzzles in the Style of Cheryl's Birthday">When Cheryl Met Eve: A Birthday Story</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/CherylMind.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/CherylMind.ipynb) | 2024 | <a href="ipynb/CherylMind.ipynb" title="Do LLMs have enough theory of mind to solve the Cheryl's Birthday puzzle?">LLMs, Theory of Mind, and Cheryl's Birthday</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/xkcd1313.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/xkcd1313.ipynb) | 2015 | <a href="ipynb/xkcd1313.ipynb" title="Find the smallest regular expression; inspired by Randall Munroe">xkcd 1313: Regex Golf</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/xkcd1313-part2.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/xkcd1313-part2.ipynb) | 2015 | <a href="ipynb/xkcd1313-part2.ipynb" title="Regex Golf: better, faster, funner (with Stefan Pochmann)">xkcd 1313: Regex Golf (Part 2: Infinite Problems)</a> |
|Run|Year|Word Puzzles|
|Open|Year|Word Puzzles|
|---|---|---|
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Boggle.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FBoggle.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FBoggle.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Boggle.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Boggle.ipynb) | 2020 | <a href="ipynb/Boggle.ipynb" title="Find all the words on a Boggle board; then find a board with a lot of words">Boggle / Inverse Boggle</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/ElementSpelling.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FElementSpelling.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FElementSpelling.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/ElementSpelling.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/ElementSpelling.ipynb) | 2020 | <a href="ipynb/ElementSpelling.ipynb" title="Spelling words using the chemical element symbols, like CoIn">Chemical Element Spelling</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/clvr.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2Fclvr.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2Fclvr.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/clvr.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/clvr.ipynb) | 2026 | <a href="ipynb/clvr.ipynb" title="Guess famous phrases from letter shapes. Beginner level.">Did you solve it? R y clvr ngh t rd ths sntnc?</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/equilength-numbers.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2Fequilength-numbers.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2Fequilength-numbers.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/equilength-numbers.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/equilength-numbers.ipynb) | 2020 | <a href="ipynb/equilength-numbers.ipynb" title="What number names have the same letter count as the number they name (such as FOUR)?">Equilength Numbers: FOUR = 4</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Gesture%20Typing.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FGesture%20Typing.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FGesture%20Typing.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Gesture%20Typing.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Gesture%20Typing.ipynb) | 2017 | <a href="ipynb/Gesture%20Typing.ipynb" title="What word has the longest path on a gesture-typing smartphone keyboard?">Gesture Typing</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Ghost.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FGhost.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FGhost.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Ghost.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Ghost.ipynb) | 2017 | <a href="ipynb/Ghost.ipynb" title="The word game Ghost (add letters, try to avoid making a word)">Ghost: A Word game</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/How%20to%20Do%20Things%20with%20Words.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FHow%20to%20Do%20Things%20with%20Words.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FHow%20to%20Do%20Things%20with%20Words.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/How%20to%20Do%20Things%20with%20Words.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/How%20to%20Do%20Things%20with%20Words.ipynb) | 2018 | <a href="ipynb/How%20to%20Do%20Things%20with%20Words.ipynb" title="Spelling Correction, Secret Codes, Word Segmentation, and more">How to Do Things with Words: NLP in Python</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Fred%20Buns.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FFred%20Buns.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FFred%20Buns.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Fred%20Buns.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Fred%20Buns.ipynb) | 2015 | <a href="ipynb/Fred%20Buns.ipynb" title="A tale of a bicycle combination lock that uses letters instead of digits. Inspired by Bike Snob NYC">Let's Code About Bike Locks</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/OneLetterOff.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FOneLetterOff.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FOneLetterOff.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/OneLetterOff.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/OneLetterOff.ipynb) | 2023 | <a href="ipynb/OneLetterOff.ipynb" title="Word game; use of a large language model to generate clues.">One Letter Off</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Scrabble.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FScrabble.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FScrabble.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Scrabble.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Scrabble.ipynb) | 2017 | <a href="ipynb/Scrabble.ipynb" title="Refactoring the Scrabble / Word with Friends game from Udacity 212">Scrabble: Refactoring a Crossword Game Program</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/SpellingBee.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FSpellingBee.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FSpellingBee.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/SpellingBee.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/SpellingBee.ipynb) | 2020 | <a href="ipynb/SpellingBee.ipynb" title="Find the highest-scoring board for the NY Times Spelling Bee puzzle">Spelling Bee</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/PropositionalLogic.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FPropositionalLogic.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FPropositionalLogic.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/PropositionalLogic.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/PropositionalLogic.ipynb) | 2017 | <a href="ipynb/PropositionalLogic.ipynb" title="Automatically convert informal English sentences into formal Propositional Logic">Translating English into Propositional Logic</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Jotto.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FJotto.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FJotto.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Jotto.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Jotto.ipynb) | 2020 | <a href="ipynb/Jotto.ipynb" title="The word guessing games Wordle, Evil Wordle, Antiwordle, and Jotto">Wordle, Evil Wordle, Antiwordle, and Jotto</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Wordle.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FWordle.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FWordle.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Wordle.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Wordle.ipynb) | 2022 | <a href="ipynb/Wordle.ipynb" title="A simple human-usable strategy to always win at Wordle. And an analysis of 2-guess wins">Winning Wordle</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/pal3.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2Fpal3.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2Fpal3.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/pal3.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/pal3.ipynb) | 2017 | <a href="ipynb/pal3.ipynb" title="Searching for a long Panama-style palindrome, this time letter-by-letter">World's Longest Palindrome</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Portmantout.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FPortmantout.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FPortmantout.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Portmantout.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Portmantout.ipynb) | 2020 | <a href="ipynb/Portmantout.ipynb" title="Find a word that squishes together a bunch of words">World's Shortest Portmantout Word</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/xkcd-Name-Dominoes.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2Fxkcd-Name-Dominoes.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2Fxkcd-Name-Dominoes.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/xkcd-Name-Dominoes.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/xkcd-Name-Dominoes.ipynb) | 2018 | <a href="ipynb/xkcd-Name-Dominoes.ipynb" title="Lay out dominoes legally; the dominoes have people names, not numbers">xkcd 1970: Name Dominoes</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Boggle.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Boggle.ipynb) | 2020 | <a href="ipynb/Boggle.ipynb" title="Find all the words on a Boggle board; then find a board with a lot of words">Boggle / Inverse Boggle</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/ElementSpelling.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/ElementSpelling.ipynb) | 2020 | <a href="ipynb/ElementSpelling.ipynb" title="Spelling words using the chemical element symbols, like CoIn">Chemical Element Spelling</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/clvr.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/clvr.ipynb) | 2026 | <a href="ipynb/clvr.ipynb" title="Guess famous phrases from letter shapes. Beginner level.">Did you solve it? R y clvr ngh t rd ths sntnc?</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/equilength-numbers.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/equilength-numbers.ipynb) | 2020 | <a href="ipynb/equilength-numbers.ipynb" title="What number names have the same letter count as the number they name (such as FOUR)?">Equilength Numbers: FOUR = 4</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Gesture%20Typing.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Gesture%20Typing.ipynb) | 2017 | <a href="ipynb/Gesture%20Typing.ipynb" title="What word has the longest path on a gesture-typing smartphone keyboard?">Gesture Typing</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Ghost.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Ghost.ipynb) | 2017 | <a href="ipynb/Ghost.ipynb" title="The word game Ghost (add letters, try to avoid making a word)">Ghost: A Word game</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/How%20to%20Do%20Things%20with%20Words.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/How%20to%20Do%20Things%20with%20Words.ipynb) | 2018 | <a href="ipynb/How%20to%20Do%20Things%20with%20Words.ipynb" title="Spelling Correction, Secret Codes, Word Segmentation, and more">How to Do Things with Words: NLP in Python</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Fred%20Buns.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Fred%20Buns.ipynb) | 2015 | <a href="ipynb/Fred%20Buns.ipynb" title="A tale of a bicycle combination lock that uses letters instead of digits. Inspired by Bike Snob NYC">Let's Code About Bike Locks</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/OneLetterOff.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/OneLetterOff.ipynb) | 2023 | <a href="ipynb/OneLetterOff.ipynb" title="Word game; use of a large language model to generate clues.">One Letter Off</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Scrabble.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Scrabble.ipynb) | 2017 | <a href="ipynb/Scrabble.ipynb" title="Refactoring the Scrabble / Word with Friends game from Udacity 212">Scrabble: Refactoring a Crossword Game Program</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/SpellingBee.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/SpellingBee.ipynb) | 2020 | <a href="ipynb/SpellingBee.ipynb" title="Find the highest-scoring board for the NY Times Spelling Bee puzzle">Spelling Bee</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/PropositionalLogic.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/PropositionalLogic.ipynb) | 2017 | <a href="ipynb/PropositionalLogic.ipynb" title="Automatically convert informal English sentences into formal Propositional Logic">Translating English into Propositional Logic</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Jotto.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Jotto.ipynb) | 2020 | <a href="ipynb/Jotto.ipynb" title="The word guessing games Wordle, Evil Wordle, Antiwordle, and Jotto">Wordle, Evil Wordle, Antiwordle, and Jotto</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Wordle.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Wordle.ipynb) | 2022 | <a href="ipynb/Wordle.ipynb" title="A simple human-usable strategy to always win at Wordle. And an analysis of 2-guess wins">Winning Wordle</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/pal3.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/pal3.ipynb) | 2017 | <a href="ipynb/pal3.ipynb" title="Searching for a long Panama-style palindrome, this time letter-by-letter">World's Longest Palindrome</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Portmantout.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Portmantout.ipynb) | 2020 | <a href="ipynb/Portmantout.ipynb" title="Find a word that squishes together a bunch of words">World's Shortest Portmantout Word</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/xkcd-Name-Dominoes.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/xkcd-Name-Dominoes.ipynb) | 2018 | <a href="ipynb/xkcd-Name-Dominoes.ipynb" title="Lay out dominoes legally; the dominoes have people names, not numbers">xkcd 1970: Name Dominoes</a> |
|Run|Year|The Riddler (from 538)|
|Open|Year|The Riddler (from 538)|
|---|---|---|
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Anigrams.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FAnigrams.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FAnigrams.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Anigrams.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Anigrams.ipynb) | 2022 | <a href="ipynb/Anigrams.ipynb" title="Finding the longest chain of anagrams that each add one letter">Anigrams: Word Chains</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Riddler%20Battle%20Royale.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FRiddler%20Battle%20Royale.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FRiddler%20Battle%20Royale.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Riddler%20Battle%20Royale.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Riddler%20Battle%20Royale.ipynb) | 2017 | <a href="ipynb/Riddler%20Battle%20Royale.ipynb" title="A puzzle involving allocating your troops and going up against an opponent">Battle Royale</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/ClimbingWall.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FClimbingWall.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FClimbingWall.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/ClimbingWall.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/ClimbingWall.ipynb) | 2021 | <a href="ipynb/ClimbingWall.ipynb" title="How many holds have to be placed to make a path in each climbing event">Climbing Wall</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/CrossProduct.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FCrossProduct.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FCrossProduct.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/CrossProduct.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/CrossProduct.ipynb) | 2021 | <a href="ipynb/CrossProduct.ipynb" title="A puzzle where digits fill a table, subject to constraints on their products">CrossProduct</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/flipping.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2Fflipping.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2Fflipping.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/flipping.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/flipping.ipynb) | 2020 | <a href="ipynb/flipping.ipynb" title="Can you go through a deck of cards, guessing higher or lower correctly for each card?">Flipping Cards; A Guessing Game</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/RiddlerLottery.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FRiddlerLottery.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FRiddlerLottery.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/RiddlerLottery.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/RiddlerLottery.ipynb) | 2019 | <a href="ipynb/RiddlerLottery.ipynb" title="Can you find what lottery number tickets these five friends picked?">Lottery</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/NightKing.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FNightKing.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FNightKing.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/NightKing.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/NightKing.ipynb) | 2019 | <a href="ipynb/NightKing.ipynb" title="A battle between the army of the dead and the army of the living">How Many Soldiers to Beat the Night King?</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Mean%20Misanthrope%20Density.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FMean%20Misanthrope%20Density.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FMean%20Misanthrope%20Density.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Mean%20Misanthrope%20Density.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Mean%20Misanthrope%20Density.ipynb) | 2017 | <a href="ipynb/Mean%20Misanthrope%20Density.ipynb" title="How crowded will this neighborhood be, if nobody wants to live next door to anyone else?">Misanthropic Neighbors</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Orderable%20Cards.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FOrderable%20Cards.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FOrderable%20Cards.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Orderable%20Cards.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Orderable%20Cards.ipynb) | 2018 | <a href="ipynb/Orderable%20Cards.ipynb" title="Can you get your hand of cards into a nice order with just one move?">Properly Organized Card Hands</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/RaceTrack.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FRaceTrack.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FRaceTrack.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/RaceTrack.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/RaceTrack.ipynb) | 2021 | <a href="ipynb/RaceTrack.ipynb" title="Race virtual cars around a circular track defined on a grid of points.">Race Track</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/SplitStates.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FSplitStates.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FSplitStates.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/SplitStates.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/SplitStates.ipynb) | 2021 | <a href="ipynb/SplitStates.ipynb" title="Split the US states into two near-halves by area.">Split the States</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/TourDe538.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FTourDe538.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FTourDe538.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/TourDe538.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/TourDe538.ipynb) | 2020 | <a href="ipynb/TourDe538.ipynb" title="Solve a puzzle involving the best pace for a bicycle race.">Tour de 538</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/TwelveBalls.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FTwelveBalls.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FTwelveBalls.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/TwelveBalls.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/TwelveBalls.ipynb) | 2020 | <a href="ipynb/TwelveBalls.ipynb" title="A puzzle where you are given some billiard balls and a balance scale, and asked to find the one ball that is heavier or lighter, in a limited number of weighings">Weighing Twelve Balls</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/war.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2Fwar.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2Fwar.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/war.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/war.ipynb) | 2020 | <a href="ipynb/war.ipynb" title="How likely is it to win a game of war in 26 turns?">War. What is it Good For?</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Anigrams.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Anigrams.ipynb) | 2022 | <a href="ipynb/Anigrams.ipynb" title="Finding the longest chain of anagrams that each add one letter">Anigrams: Word Chains</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Riddler%20Battle%20Royale.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Riddler%20Battle%20Royale.ipynb) | 2017 | <a href="ipynb/Riddler%20Battle%20Royale.ipynb" title="A puzzle involving allocating your troops and going up against an opponent">Battle Royale</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/ClimbingWall.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/ClimbingWall.ipynb) | 2021 | <a href="ipynb/ClimbingWall.ipynb" title="How many holds have to be placed to make a path in each climbing event">Climbing Wall</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/CrossProduct.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/CrossProduct.ipynb) | 2021 | <a href="ipynb/CrossProduct.ipynb" title="A puzzle where digits fill a table, subject to constraints on their products">CrossProduct</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/flipping.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/flipping.ipynb) | 2020 | <a href="ipynb/flipping.ipynb" title="Can you go through a deck of cards, guessing higher or lower correctly for each card?">Flipping Cards; A Guessing Game</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/RiddlerLottery.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/RiddlerLottery.ipynb) | 2019 | <a href="ipynb/RiddlerLottery.ipynb" title="Can you find what lottery number tickets these five friends picked?">Lottery</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/NightKing.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/NightKing.ipynb) | 2019 | <a href="ipynb/NightKing.ipynb" title="A battle between the army of the dead and the army of the living">How Many Soldiers to Beat the Night King?</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Mean%20Misanthrope%20Density.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Mean%20Misanthrope%20Density.ipynb) | 2017 | <a href="ipynb/Mean%20Misanthrope%20Density.ipynb" title="How crowded will this neighborhood be, if nobody wants to live next door to anyone else?">Misanthropic Neighbors</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Orderable%20Cards.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Orderable%20Cards.ipynb) | 2018 | <a href="ipynb/Orderable%20Cards.ipynb" title="Can you get your hand of cards into a nice order with just one move?">Properly Organized Card Hands</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/RaceTrack.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/RaceTrack.ipynb) | 2021 | <a href="ipynb/RaceTrack.ipynb" title="Race virtual cars around a circular track defined on a grid of points.">Race Track</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/SplitStates.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/SplitStates.ipynb) | 2021 | <a href="ipynb/SplitStates.ipynb" title="Split the US states into two near-halves by area.">Split the States</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/TourDe538.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/TourDe538.ipynb) | 2020 | <a href="ipynb/TourDe538.ipynb" title="Solve a puzzle involving the best pace for a bicycle race.">Tour de 538</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/TwelveBalls.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/TwelveBalls.ipynb) | 2020 | <a href="ipynb/TwelveBalls.ipynb" title="A puzzle where you are given some billiard balls and a balance scale, and asked to find the one ball that is heavier or lighter, in a limited number of weighings">Weighing Twelve Balls</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/war.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/war.ipynb) | 2020 | <a href="ipynb/war.ipynb" title="How likely is it to win a game of war in 26 turns?">War. What is it Good For?</a> |
|Run|Year|Computer Science Algorithms and Concepts|
|Open|Year|Computer Science Algorithms and Concepts|
|---|---|---|
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/BASIC.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FBASIC.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FBASIC.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/BASIC.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/BASIC.ipynb) | 2017 | <a href="ipynb/BASIC.ipynb" title="How to write an interpreter for the BASIC programming language">BASIC Interpreter</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Convex%20Hull.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FConvex%20Hull.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FConvex%20Hull.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Convex%20Hull.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Convex%20Hull.ipynb) | 2017 | <a href="ipynb/Convex%20Hull.ipynb" title="A classic Computer Science Algorithm">Convex Hull Problem</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/DocstringFixpoint.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FDocstringFixpoint.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FDocstringFixpoint.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/DocstringFixpoint.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/DocstringFixpoint.ipynb) | 2023 | <a href="ipynb/DocstringFixpoint.ipynb" title="An approach to writing code and docstrings that go together.">Docstring Fixpoint Theory</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/StableMatching.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FStableMatching.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FStableMatching.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/StableMatching.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/StableMatching.ipynb) | 2020 | <a href="ipynb/StableMatching.ipynb" title="What is the best way to pair up two groups with each other, obeying preferences?">Stable Matching Problem</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Differentiation.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FDifferentiation.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FDifferentiation.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Differentiation.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Differentiation.ipynb) | 2017 | <a href="ipynb/Differentiation.ipynb" title="A computer algebra system, including symbolic differentiation">Symbolic Algebra, Simplification, and Differentiation</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Snobol.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FSnobol.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FSnobol.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Snobol.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/Snobol.ipynb) | 2017 | <a href="ipynb/Snobol.ipynb" title="As a student, did you ever get a bad grade on a programming assignment?">Snobol: Bad Grade, Good Experience</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/TSP.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FTSP.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FTSP.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/TSP.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/TSP.ipynb) | 2018 | <a href="ipynb/TSP.ipynb" title="Another of the classics">Traveling Salesperson Problem</a> |
| [C](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/TruncatablePrimes.ipynb) [D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2FTruncatablePrimes.ipynb) [M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2FTruncatablePrimes.ipynb) [N](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/TruncatablePrimes.ipynb) [S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes/blob/main/ipynb/TruncatablePrimes.ipynb) | 2026 | <a href="ipynb/TruncatablePrimes.ipynb" title="Prime numbers where you can remove digits and still get primes.">Truncatable Primes</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/BASIC.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/BASIC.ipynb) | 2017 | <a href="ipynb/BASIC.ipynb" title="How to write an interpreter for the BASIC programming language">BASIC Interpreter</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Convex%20Hull.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Convex%20Hull.ipynb) | 2017 | <a href="ipynb/Convex%20Hull.ipynb" title="A classic Computer Science Algorithm">Convex Hull Problem</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/lispy.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/lispy.ipynb) | 2026 | <a href="ipynb/lispy.ipynb" title="Tutorial on interpreters.">(How to Write a (Lisp) Interpreter (in Python))</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/DocstringFixpoint.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/DocstringFixpoint.ipynb) | 2023 | <a href="ipynb/DocstringFixpoint.ipynb" title="An approach to writing code and docstrings that go together.">Docstring Fixpoint Theory</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/StableMatching.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/StableMatching.ipynb) | 2020 | <a href="ipynb/StableMatching.ipynb" title="What is the best way to pair up two groups with each other, obeying preferences?">Stable Matching Problem</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Differentiation.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Differentiation.ipynb) | 2017 | <a href="ipynb/Differentiation.ipynb" title="A computer algebra system, including symbolic differentiation">Symbolic Algebra, Simplification, and Differentiation</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Snobol.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/Snobol.ipynb) | 2017 | <a href="ipynb/Snobol.ipynb" title="As a student, did you ever get a bad grade on a programming assignment?">Snobol: Bad Grade, Good Experience</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/TSP.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/TSP.ipynb) | 2018 | <a href="ipynb/TSP.ipynb" title="Another of the classics">Traveling Salesperson Problem</a> |
| [co](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/TruncatablePrimes.ipynb) [nb](https://nbviewer.jupyter.org/github/norvig/pytudes/blob/main/ipynb/TruncatablePrimes.ipynb) | 2026 | <a href="ipynb/TruncatablePrimes.ipynb" title="Prime numbers where you can remove digits and still get primes.">Truncatable Primes</a> |
# Index of Python Files

259
ipynb/RationalPi.ipynb Normal file
View File

@@ -0,0 +1,259 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "5b025dd9-9345-402d-9be0-dd0c17842915",
"metadata": {},
"source": [
"<div align=\"right\" style=\"text-align: right\"><i>Peter Norvig<br>May 2026</i></div>\n",
"\n",
"# Fractions approximating π\n",
"\n",
"The number π is irrational, which means that it cannot be represented exactly by a fraction. But some fractions, such as 22/7, are known to come close to π. In this notebook, we look for fractions that approximate π even more closely than 22/7.\n",
"\n",
"If we want to know *what's the best fraction approximation to π with a denominator no more than a given number of digits?* we can try every possible denominator up to the given number of digits, compute the best numerator (and hence the best fraction) for each denominator, and choose the resulting fraction that minimizes the distance to the target, π (or if we want, any target):"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "00c9ebd9-ee55-4dcb-917a-9c7a098d3816",
"metadata": {},
"outputs": [],
"source": [
"from fractions import Fraction\n",
"from math import pi\n",
"\n",
"def approximation(target=pi, digits=6) -> Fraction:\n",
" \"\"\"The fraction best approximating `target` whose denominator has no more than `digits` digits.\"\"\"\n",
" denominators = range(1, 10 ** digits)\n",
" fractions = (Fraction(round(target * d), d) for d in denominators)\n",
" return min(fractions, key=lambda x: abs(target - x))"
]
},
{
"cell_type": "markdown",
"id": "49db7449-1f81-4a7f-842a-84348dc5f16a",
"metadata": {},
"source": [
"For example, here are the best approximations with one- and three-digit denominators:"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "de87500e-62cf-48fe-adee-3625f4cf6742",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Fraction(22, 7)"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"approximation(pi, 1)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "3e9e799a-437a-45ff-8182-3d8d3342fe3a",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Fraction(355, 113)"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"approximation(pi, 3)"
]
},
{
"cell_type": "markdown",
"id": "4408e472-e7e6-4cc7-8a6b-790a55860bd3",
"metadata": {},
"source": [
"We can make a pretty report showing the best approximations to π with 1, 2, 3, 4, and 5-digit denominators:"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "59faedd9-4899-4ccd-858b-fb5e4032a0cd",
"metadata": {},
"outputs": [],
"source": [
"def report(approximator=approximation, target=pi, d_range=range(1, 6)) -> str:\n",
" \"\"\"For each `d` in `d_range`, print a description of how close \n",
" the fraction `approximator(target, d)` is to `target`.\"\"\"\n",
" for d in d_range:\n",
" r = approximator(target, d)\n",
" print(f'{r:^22} = {r:.25f} (error {r-target:+6.0e})')"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "24447e10-a58f-43f2-93e5-3b058c098096",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" 22/7 = 3.1428571428571428571428571 (error +1e-03)\n",
" 311/99 = 3.1414141414141414141414141 (error -2e-04)\n",
" 355/113 = 3.1415929203539823008849558 (error +3e-07)\n",
" 355/113 = 3.1415929203539823008849558 (error +3e-07)\n",
" 312689/99532 = 3.1415926536189366233975003 (error +3e-11)\n"
]
}
],
"source": [
"report()"
]
},
{
"cell_type": "markdown",
"id": "5f21ad7f-193b-412e-b175-4cf9975cffd2",
"metadata": {},
"source": [
"(The approximation 355/113 is so good that no 4-digit-denominator is better. You can think of 3550/1130 as the best 4-digit approximation.)"
]
},
{
"cell_type": "markdown",
"id": "9c035f0d-5cb8-4092-8ed1-883f9a9dd30d",
"metadata": {},
"source": [
"# Faster, Better Approximations\n",
"\n",
"A 5-digit denominator is the most that `approximation` can handle in under a second of run time. \n",
"\n",
"We can get better approximations much faster by iteratively improving a guess:\n",
"- The zeroth approximation to π is formed by rounding to the nearest integer, **3**.\n",
"- The first approximation to π is formed by adding 3 to an approximation of the remainder after rounding, 0.14159...\n",
" - Rounding the remainder would give us 0, so that doesn't help.\n",
" - Instead of rounding the remainder, use (1 / approximation(1 / remainder)).\n",
" - 1 / 0.14159... rounds to 7 (with remainder 0.06251...) so the first approximation is **3 + (1/7) = 22/7**.\n",
"- The second approximation to π is formed by adding in an approximation of 0.06251...\n",
" - 1 / 0.06251... rounds to 16, so the second approximation is **3 + (1/(7 + 1/16)) = 355/113**.\n",
" - You can repeat the approximation process to any depth.\n",
" \n",
"We can implement it like this:"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "f81761ad-1b21-4dce-9fba-9621447617d1",
"metadata": {},
"outputs": [],
"source": [
"PI = Fraction(\"3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803\")\n",
"\n",
"def fast_approximation(target: Fraction, depth: int) -> Fraction:\n",
" \"\"\"Approximate `target` by taking the whole part plus an approximation to the remainder.\n",
" Repeat `depth` times (or stop when there is no remainder).\n",
" Use (1 / fast_approximation(1 / remainder)), because remainder < 1 and (1 / remainder) > 1.\"\"\"\n",
" whole = round(target)\n",
" remainder = target - whole\n",
" if depth == 0 or remainder == 0:\n",
" return Fraction(whole)\n",
" else:\n",
" return whole + (1 / fast_approximation(1 / remainder, depth - 1))"
]
},
{
"cell_type": "markdown",
"id": "7e3c32d2-66f7-450f-9dc3-e5034dfd09c5",
"metadata": {},
"source": [
"This gives an approximation accurate to 22 digits after 14 iterations, and takes just milliseconds to run:"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "ba7e0c79-515e-48c8-9f7b-a4a99734b9be",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" 3 = 3.0000000000000000000000000 (error -1e-01)\n",
" 22/7 = 3.1428571428571428571428571 (error +1e-03)\n",
" 355/113 = 3.1415929203539823008849558 (error +3e-07)\n",
" 104348/33215 = 3.1415926539214210447087159 (error +3e-10)\n",
" 312689/99532 = 3.1415926536189366233975003 (error +3e-11)\n",
" 1146408/364913 = 3.1415926535914039784825424 (error +2e-12)\n",
" 5419351/1725033 = 3.1415926535898153832419438 (error +2e-14)\n",
" 80143857/25510582 = 3.1415926535897926593756269 (error -6e-16)\n",
" 245850922/78256779 = 3.1415926535897931602832772 (error -8e-17)\n",
" 411557987/131002976 = 3.1415926535897932578264482 (error +2e-17)\n",
" 1068966896/340262731 = 3.1415926535897932353925649 (error -3e-18)\n",
" 2549491779/811528438 = 3.1415926535897932390140098 (error +6e-19)\n",
"6167950454/1963319607 = 3.1415926535897932383863775 (error -8e-20)\n",
"21053343141/6701487259 = 3.1415926535897932384623817 (error -3e-22)\n"
]
}
],
"source": [
"report(fast_approximation, PI, range(14))"
]
},
{
"cell_type": "markdown",
"id": "c4f1404b-a9b2-4aaa-be83-d34bab26d734",
"metadata": {},
"source": [
"It turns out there is a name for this approach: it is the [continued fraction approximation to π](https://en.wikipedia.org/wiki/Pi#Continued_fractions). \n",
"\n",
"Note: it is more traditional to use `whole = int(target)` rather than `whole = round(target)` to generate the continued fractions. Using `round` gives better fractions in fewer itera, but using `int` has the nice property that all the bits we add are positive."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4ea1db23-b668-4854-86ea-337462a18a8b",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python [conda env:base] *",
"language": "python",
"name": "conda-base-py"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.13.9"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

View File

@@ -16,7 +16,7 @@
"\n",
"# The Concordance Assignment\n",
"\n",
"> *Using the [`Snobol`](http://www.snobol4.org/) language, read lines of text from the standard input and print a *concordance*, which is an alphabetized list of words in the text, with the line number(s) where each word appears. Words with different capitalization (like \"A\" and \"a\") should be merged into one entry.*\n",
"> *Using the [`Snobol`](http://www.snobol4.org/) language, read lines of text from the standard input and print a **concordance**, which is an alphabetized list of words in the text, with the line number(s) where each word appears. Words with different capitalization (like \"A\" and \"a\") should be merged into one entry.*\n",
"\n",
"After studying Snobol a bit, I realized that the expected solution was along these lines:\n",
"\n",

View File

@@ -294,8 +294,8 @@
"metadata": {},
"outputs": [],
"source": [
"def guess_row(guess) -> Tuple[Word, int, float, int]:\n",
" \"\"\"A tuple of a (guess word, nuber of guaranteed wins, expected wins, maximum bin size).\"\"\"\n",
"def guess_row(guess) -> Tuple[Word, int, float]:\n",
" \"\"\"A tuple of a (guess word, number of guaranteed wins, expected wins).\"\"\"\n",
" B = bins([guess], words)\n",
" return (guess, sum(len(bin) == 1 for bin in B), sum(1 / len(bin) for bin in B))\n",
"\n",

File diff suppressed because it is too large Load Diff

View File

@@ -6,6 +6,7 @@ notebooks = {
'Programming Examples': [
("AlphaCode Automated Programming", 2022, 'AlphaCode.ipynb', "Analysis of AlphaCode's automated solution to a coding problem"),
("Approximating Pi with a Fraction", 2026, 'RationalPi.ipynb', "Using continued fractions to find fractions (like 22/7) that are close to pi."),
('The Babylonian Number System', 2022, 'Babylonian%20digits.ipynb', 'Translating between Babylonian and traditional number systems.'),
("Beal's Conjecture Revisited", 2018, 'Beal.ipynb', "A search for counterexamples to Beal's Conjecture"),
('Bicycling Statistics', 2020, 'Bike-Stats.ipynb', 'Visualizing statistics about bike routes'),
@@ -57,7 +58,7 @@ notebooks = {
('How to Count Things', 2020, 'How%20To%20Count%20Things.ipynb', 'Combinatorial math: how to count how many things there are, when there are a lot of them'),
('KenKen (Sudoku-like Puzzle)', 2021, 'KenKen.ipynb', 'A Sudoku-like puzzle, but with arithmetic.'),
('Number Bracelets Game', 2024, 'NumberBracelets.ipynb', 'A game involving numbered beads on a circular bracelet.'),
('Project Euler #3: Largest prime factor', 'Euler3.ipynb', 2026, 'Find the largest prime factor of a number'),
('Project Euler #3: Largest prime factor', 2026, 'Euler3.ipynb', 'Find the largest prime factor of a number'),
('Pairing Socks', 2019, 'Socks.ipynb', 'What is the probability that you will be able to pair up socks as you randomly pull them out of the dryer?'),
('Sicherman Dice', 2018, 'Sicherman%20Dice.ipynb', 'Find a pair of dice that is like a regular pair of dice, only different'),
("Sol Golomb's Rectangle Puzzle", 2014, 'Golomb-Puzzle.ipynb', 'A Puzzle involving placing rectangles of different sizes inside a square'),
@@ -111,6 +112,7 @@ notebooks = {
'Computer Science Algorithms and Concepts': [
('BASIC Interpreter', 2017, 'BASIC.ipynb', 'How to write an interpreter for the BASIC programming language'),
('Convex Hull Problem', 2017, 'Convex%20Hull.ipynb', 'A classic Computer Science Algorithm'),
('(How to Write a (Lisp) Interpreter (in Python))', 2026, 'lispy.ipynb', 'Tutorial on interpreters.'),
('Docstring Fixpoint Theory', 2023, 'DocstringFixpoint.ipynb', 'An approach to writing code and docstrings that go together.'),
('Stable Matching Problem', 2020, 'StableMatching.ipynb', 'What is the best way to pair up two groups with each other, obeying preferences?'),
('Symbolic Algebra, Simplification, and Differentiation', 2017, 'Differentiation.ipynb', 'A computer algebra system, including symbolic differentiation'),
@@ -145,7 +147,7 @@ import re
import urllib.request
current_year = 2026
new_year = current_year - 2 # What `find_newest` looks for
new_year = current_year - 1 # What `find_newest` looks for
def read_url(url: str) -> str:
"""Reads a file from the specified URL and returns its content as a string."""
@@ -192,20 +194,20 @@ def find_newest(notebooks, label='New', year=new_year) -> None:
def format_category(category) -> str:
"""Make a table of multiple jupyter/ipython notebooks, under a header."""
print(f'{len(notebooks[category]):2d} notebooks in {category}')
return table(('Run', 'Year', category),
return table(('Open', 'Year', category),
[format_notebook(*line) for line in notebooks[category]])
def format_notebook(title, year, url, comment=''):
"""Make a markdown table entry for a jupyter/ipython notebook."""
urlb = f'/blob/main/ipynb/{url}'
co = f'[C](https://colab.research.google.com/github/norvig/pytudes{urlb})'
co = f'[co](https://colab.research.google.com/github/norvig/pytudes{urlb})'
gh = f'[G](ipynb/{url})'
dn = f'[D](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fblob%2Fmain%2Fipynb%2F{url})'
my = f'[M](https://mybinder.org/v2/gh/norvig/pytudes/main?filepath=ipynb%2F{url})'
nb = f'[N](https://nbviewer.jupyter.org/github/norvig/pytudes{urlb})'
nb = f'[nb](https://nbviewer.jupyter.org/github/norvig/pytudes{urlb})'
sm = f'[S](https://studiolab.sagemaker.aws/import/github/norvig/pytudes{urlb})'
ti = f'<a href="{gh[4:-1]}" title="{comment}">{title}</a>'
return f'| {co} {dn} {my} {nb} {sm} | {year} | {ti} |'
return f'| {co} {nb} | {year} | {ti} |'
def format_pythons() -> str:
"""Make a table of multiple python programs."""
@@ -237,12 +239,9 @@ To continue the musical analogy, some people think of programming like [Spotify]
# Index of Jupyter (IPython) Notebooks
For each notebook you can hover on the title to see a description, or click the title to view on github, or click one of the letters in the left column to launch the notebook on
[**C**olab](https://colab.research.google.com),
[**D**eepnote](https://deepnote.com),
[**M**ybinder](https://mybinder.org),
[**S**agemaker](https://studiolab.sagemaker.aws/), or
[**N**BViewer](https://nbviewer.jupyter.org/).
For each notebook you can hover on the title to see a description, or click the title to view on github, or click one of the letters in the left column to open the notebook on
[**co**lab](https://colab.research.google.com) or
[**nb**viewer](https://nbviewer.jupyter.org/).
{format_notebooks()}