This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ### A Pluto.jl notebook ### | |
| # v0.20.19 | |
| using Markdown | |
| using InteractiveUtils | |
| # ╔═╡ 87b56f06-a5e7-11f0-bc5d-fd4c15c7ba48 | |
| begin | |
| using Pkg | |
| Pkg.activate(".") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use itertools::Itertools; | |
| use rayon::prelude::*; | |
| /// For a given list of numbers, try counting all the possible ways of pulling out all | |
| /// possible numbers of elements, see if it is sorted, and if so, collect the one with | |
| /// the maximum length. | |
| fn calc_max_score(nums: &[usize]) -> usize { | |
| // Use the power set to go through all possible combos of all possible elements, | |
| // while retaining the order of the elements | |
| nums.iter() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ### A Pluto.jl notebook ### | |
| # v0.20.8 | |
| using Markdown | |
| using InteractiveUtils | |
| # ╔═╡ 446b951f-049b-441a-a869-03529b1ef965 | |
| using Graphs, GraphMakie, CairoMakie | |
| # ╔═╡ fc389c8e-771e-430d-866e-4188cd9d8c3f |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ### A Pluto.jl notebook ### | |
| # v0.19.46 | |
| using Markdown | |
| using InteractiveUtils | |
| # ╔═╡ de87c273-9da1-403f-b0c0-af180e67f743 | |
| using Chairmarks | |
| # ╔═╡ 751fe577-314a-43fb-bf79-6d6444642390 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ### A Pluto.jl notebook ### | |
| # v0.19.29 | |
| using Markdown | |
| using InteractiveUtils | |
| # ╔═╡ dff33215-c1f4-47db-bfd1-24de63c9f67d | |
| using Distributions | |
| # ╔═╡ 5d67bf6a-6a9d-11ee-3858-5be18c658ac6 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Combinatorics | |
| using Test | |
| #= | |
| https://thefiddler.substack.com/i/135704603/making-the-rounds | |
| Sixteen chocolates sit in a four-by-four box. Can you remove six from the box so | |
| that an even number is left in each row and each column? | |
| Once you’ve solved it, you can further challenge yourself by counting how many |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| # [Middle Square Method](https://fivethirtyeight.com/features/can-you-solve-middle-square-madness/) | |
| Thanks to Twitter, I recently became aware of the “middle-square method” for generating | |
| pseudorandom numbers (numbers that appear random, but are derived in a deterministic | |
| sequence). | |
| This week, let's look at the middle-square method for generating pseudorandom four-digit | |
| numbers. First, we start with a four-digit number, such as 9,876. If we square it, we | |
| get the eight-digit number 97,535,376. Our next pseudorandom number is taken from the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from itertools import permutations, pairwise | |
| from pprint import pprint | |
| from typing import Iterable | |
| """ | |
| https://fivethirtyeight.com/features/can-you-turn-digits-into-numbers/ | |
| From Jeremy Dixon comes a “toasty” treat of a puzzle: | |
| You have a toast rack with five slots, arranged in an array. Each slot has a slice of | |
| toasted bread, which you are removing one at a time. However, you are quite |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Combinatorics | |
| """ | |
| Riddler Express (https://fivethirtyeight.com/features/can-you-fend-off-the-alien-armada/) | |
| You and a friend are shooting some hoops at your local basketball court when she issues | |
| a challenge: She will name a number, which we'll call N. Your goal is to score exactly N | |
| points in as many ways as possible using only 2-point and 3-point shots. The order of | |
| your shots does not matter. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| https://fivethirtyeight.com/features/can-you-make-it-to-2023/ | |
| From Dean Ballard comes a puzzle to help us ring in the new year, 2023: | |
| The Fibonacci sequence begins with the numbers 1 and 1,2 with each new term in the | |
| sequence equal to the sum of the preceding two. The first few numbers of the Fibonacci | |
| sequence are 1, 1, 2, 3, 5, 8, 13, 21, 34, 55 and so on. | |
| One can also make variations of the Fibonacci sequence by starting with a different pair |
NewerOlder