Compare commits
9
Commits
6adb699d55
...
19d2b079e2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
19d2b079e2 | ||
|
|
708e128e23 | ||
|
|
062c0e7cd8 | ||
|
|
fa14771d00 | ||
|
|
1a6261e1b6 | ||
|
|
35a892134f | ||
|
|
e13dfe5705 | ||
|
|
76bc8a483e | ||
|
|
504da3f655 |
No files matched your search
@@ -5,24 +5,19 @@ on:
|
||||
paths:
|
||||
- 'py/pytudes.py'
|
||||
|
||||
env:
|
||||
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
|
||||
|
||||
jobs:
|
||||
build-and-update:
|
||||
runs-on: ubuntu-latest
|
||||
# Added permissions to allow the bot to write to the repo
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.10'
|
||||
uses: actions/setup-python@v7
|
||||
|
||||
- name: Run pytudes.py
|
||||
run: python py/pytudes.py
|
||||
@@ -32,6 +27,5 @@ jobs:
|
||||
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git config --local user.name "github-actions[bot]"
|
||||
git add README.md
|
||||
# The || exit 0 prevents the workflow from failing if there are no changes
|
||||
git commit -m "docs: auto-update README.md via pytudes.py" || exit 0
|
||||
git push
|
||||
@@ -34,7 +34,6 @@ For each notebook you can hover on the title to see a description, or click the
|
||||
| [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> |
|
||||
| [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> |
|
||||
|
||||
|
||||
|Open|Year|Large Language Models|
|
||||
@@ -114,7 +113,7 @@ For each notebook you can hover on the title to see a description, or click the
|
||||
| [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/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 Chain 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/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 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/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> |
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
"> 9 × 7 × 5 × 3 × 1 = 945.\n",
|
||||
"\n",
|
||||
"(It is always a relief when two methods give the same answer.)\n",
|
||||
" \n",
|
||||
"\n",
|
||||
"**Method 3: Write a program to enumerate the sets:** We'll represent the 1 × 3 rectangle as the tuple `(1, 3)` and the example set of rectangles as the set\n",
|
||||
"\n",
|
||||
" {(1, 3), (2, 4), (5, 7), (6, 8), (9, 10)}\n",
|
||||
|
||||
@@ -487,7 +487,7 @@
|
||||
"source": [
|
||||
"**Bo: Look at that!**\n",
|
||||
"\n",
|
||||
"Ali: It turns out you can <a href=\"https://www.mathartfun.com/dSpecial.html\">buy</a> a pair of dice with just these numbers, and there are some nice [charts and tables on Wikipedia](https://en.wikipedia.org/wiki/Sicherman_dice) explaining it all. \n",
|
||||
"Ali: It turns out you can <a href=\"https://www.mathartfun.com/dSpecial.html\">buy</a> a pair of dice with just these numbers, and there are some nice [charts and tables on Wikipedia](https://en.wikipedia.org/wiki/Sicherman_dice) ing it all. \n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
@@ -1317,7 +1317,7 @@
|
||||
"\n",
|
||||
"Ali: In general, what's the sum of the sides of a standard pair?\n",
|
||||
"\n",
|
||||
"**Bo: Easy, that's *N* × (*N* + 1). [Gauss](http://betterexplained.com/articles/techniques-for-adding-the-numbers-1-to-100/) knew that when he was in elementary school!**\n",
|
||||
"**Bo: Easy, that's *N* × (*N* + 1). [Gauss](http://bettered.com/articles/techniques-for-adding-the-numbers-1-to-100/) knew that when he was in elementary school!**\n",
|
||||
"\n",
|
||||
"# Better Efficiency\n",
|
||||
"\n",
|
||||
@@ -1727,11 +1727,11 @@
|
||||
"|3|0| | |\n",
|
||||
"|4 | 1 | [1, 2, 2, 3] | [1, 3, 3, 5]|\n",
|
||||
"|5|0| | |\n",
|
||||
"|6 | 1 | [1, 2, 2, 3, 3, 4] | [1, 3, 4, 5, 6, 8]\n",
|
||||
"|7 | 0 |\n",
|
||||
"|6 | 1 | [1, 2, 2, 3, 3, 4] | [1, 3, 4, 5, 6, 8]|\n",
|
||||
"|7 | 0 | | |\n",
|
||||
"|8 | 3 | [1, 2, 2, 3, 3, 4, 4, 5] | [1, 3, 5, 5, 7, 7, 9, 11]|\n",
|
||||
" ||| [1, 2, 3, 3, 4, 4, 5, 6] | [1, 2, 5, 5, 6, 6, 9, 10]|\n",
|
||||
" ||| [1, 2, 2, 3, 5, 6, 6, 7] | [1, 3, 3, 5, 5, 7, 7, 9]|\n",
|
||||
"||| [1, 2, 3, 3, 4, 4, 5, 6] | [1, 2, 5, 5, 6, 6, 9, 10]|\n",
|
||||
"||| [1, 2, 2, 3, 5, 6, 6, 7] | [1, 3, 3, 5, 5, 7, 7, 9]|\n",
|
||||
"| 9 |1 | [1, 2, 2, 3, 3, 3, 4, 4, 5] | [1, 4, 4, 7, 7, 7, 10, 10, 13]|\n",
|
||||
"| 10 | 1 | [1, 2, 2, 3, 3, 4, 4, 5, 5, 6] | [1, 3, 5, 6, 7, 8, 9, 10, 12, 14]|\n",
|
||||
"| 11 |0|||\n",
|
||||
@@ -1751,10 +1751,9 @@
|
||||
"\n",
|
||||
"- Do all composite *N* have solutions?\n",
|
||||
"- Does any prime *N* have a solution?\n",
|
||||
"- Do some *N* have more than the 3 solutions that 8 has?\n",
|
||||
"- Does the fact that 8 has 3 solutions have anything to do with the fact that 8 is a perfect cube?\n",
|
||||
"- What about the 7 solutions for 12? 12 has 6 factors; does that matter?\n",
|
||||
"- The 9 perfect squares, 4 and 9, have 1 solution each; is that true of all perfect squares?\n",
|
||||
"- The perfect squares 4 and 9 have 1 solution each; is that true of all perfect squares?\n",
|
||||
"- Could we make this 10 times faster? 100 times?\n",
|
||||
"- Could we handle greater values of *N* if we worked with [generating functions](https://en.wikipedia.org/wiki/Sicherman_dice)?\n",
|
||||
"- What about Sicherman triples (3 nonstandard dice with the same distribution of sums as 3 standard dice)?\n",
|
||||
|
||||
+6
-6
@@ -75,7 +75,7 @@ notebooks = {
|
||||
("Stubborn number endings", 2024, 'Stubborn.ipynb', 'Any number ending in 5 has a square that also ends in 5. What other endings are like this?'),
|
||||
('Square Sum Chain Puzzle', 2020, 'SquareSum.ipynb', 'Place the numbers from 1 to n in a chain (or a circle) such that adjacent pairs sum to a perfect square'),
|
||||
("When is Cheryl's Birthday?", 2020, 'Cheryl.ipynb', "Solving the *Cheryl's Birthday* logic puzzle"),
|
||||
('When Cheryl Met Eve: A Birthday Story', 2015, 'Cheryl-and-Eve.ipynb', "Inventing new puzzles in the Style of Cheryl's Birthday"),
|
||||
('When Cheryl Met Eve: A Birthday Story', 2015, 'Cheryl-and-Eve.ipynb', "Inventing puzzles in the Style of Cheryl's Birthday"),
|
||||
('xkcd 1313: Regex Golf', 2015, 'xkcd1313.ipynb', 'Find the smallest regular expression; inspired by Randall Munroe'),
|
||||
('xkcd 1313: Regex Golf (Part 2: Infinite Problems)', 2015, 'xkcd1313-part2.ipynb', 'Regex Golf: better, faster, funner (with Stefan Pochmann)')],
|
||||
|
||||
@@ -194,13 +194,13 @@ def format_notebooks() -> str:
|
||||
find_newest(notebooks)
|
||||
return '\n'.join(format_category(name) for name in notebooks)
|
||||
|
||||
def find_newest(notebooks, label='New', year=new_year) -> None:
|
||||
"""Mutate `notebooks['New']` to have a collection of newest notebooks."""
|
||||
def find_newest(notebooks, New='New', year=new_year) -> None:
|
||||
"""Mutate `notebooks[New]` to have a collection of newest notebooks, from `new_year` or later."""
|
||||
for category in notebooks:
|
||||
for line in notebooks[category]:
|
||||
if line[1] >= year:
|
||||
notebooks[label].append(line)
|
||||
notebooks[label].sort(key=lambda line: (-line[1], line[0]))
|
||||
if line[1] >= year and line not in notebooks[New]:
|
||||
notebooks[New].append(line)
|
||||
notebooks[New].sort(key=lambda line: (-line[1], line[0]))
|
||||
|
||||
def format_category(category) -> str:
|
||||
"""Make a table of multiple jupyter/ipython notebooks, under a header."""
|
||||
|
||||
Reference in new issue
Block a user