Lambdia

Mathematics & Computer Science

3 articles

5050 Minus the Total, in One Pass

Sorting the list finds the gap and is merely wasteful, which is why the article says so rather than striking it out. The subtraction works because 5050 is a closed form available before the list is read, and the two conditions carrying it are distinctness and a known range. The article adds the duplicate-hunting mirror image, the sum-of-squares route when two values are absent, and the exclusive-or accumulator for when the total would overflow.

0

Forty Cubed, Forty Squared, and the Number You Never Choose

A safe takes three numbers from a dial marked 1 to 40, so there are 64,000 combinations, and the worst case is 1600 attempts rather than 64,000. The third number is supplied by the mechanism instead of guessed, which collapses the search from three dimensions to two, and 1600 is proved both achievable and unavoidable. A dial with a mark of mechanical slack drops the count to 196, which is a covering problem on a cycle of forty.

0