Let’s start with a math puzzle from Martin Gardner’s Entertaining Mathematical Puzzles:
THE SILVER BAR
A silver prospector was unable to pay his March rent in advance. He owned a bar of pure silver, 31 inches long, so he made the following arrangement with his landlady. He would cut the bar into smaller pieces. On the first day of March, he would give the lady an inch of the bar, and on each succeeding day he would add another inch to her amount of silver. She would keep this silver as security. At the end of the month, when the prospector expected to be able to pay his rent in full, she would return the pieces to him.
March has 31 days, so one way to cut the bar would be to cut it into 31 sections, each an inch long. But since it required considerable labor to cut the bar, the prospector wished to carry out his agreement with the fewest possible number of pieces. For example, he might give the lady an inch on the first day, another inch on the second day, then on the third day he could take back the two pieces and give her a solid 3- inch section.
Assuming that portions of the bar are traded back and forth in this fashion, see if you can determine the smallest number of pieces into which the prospector needs to cut his silver bar.
Don’t read further unless you want the solution.
This is the solution:
The prospector can keep his agreement by cutting his 31-inch silver bar into as few as five sections with lengths of 1, 2, 4, 8, and 16 inches.
You’ll note that you can sum to any length up to 31 with that set of bars.
Disclosure: I read this problem aloud to my kids on Wednesday night at bedtime and none of us got the answer.
The key to this problem is it can be expressed cleanly using binary or a base-2 number system instead of using the base-10 system we are used to.
Earlier that afternoon I taught Zak (9) how to count in binary. I made these charts to summarize how I explained it to him.
It’s useful to remember that when you hear “tens place” what is really meant is the [symbol occupying that space] x 10¹
- In base-10: there’s a one’s place, tens place, hundreds place…
- In binary: there’s a one’s place, twos place, fours place, eights place…
Once Zak understood this he could represent our family members’ ages in binary. I had him do the same thing using base-8 by following the same pattern.
- In base-8: there’s a one’s place, eights place, sixty-fours place, five hundred and twelve place…
So representing my age of 44 in base-8 = 54 because there are 5 eights + 4 ones.
Computers do calculations in binary because electrical signals on a chip are either on or off. So representing numbers can be thought of like a morse code of “on”/”off” at light speed or something. Feel free to correct me, that’s my armchair impression.
Now a brutal coincidence.
Despite teaching binary that afternoon, I did not recognize it was the key to answering the riddle! Zak was flabbergasted by the coincidence that the solution was in “what’s that word you keep saying…binary?” after he just learned it. Baader-Meinhoff on steroids. (It was really cute that he kept shaking his head about the coincidence that the thing he just learned showed up in a random problem I chose that night. The coincidence hit him just as hard, maybe even harder, than it did me.)
The silver bars cut into 5 lengths as a binary solution:
This is all about to get better (or worse depending on what temperature you run at on the techno-optimism thermometer).
Yesterday, I started tinkering with OpenAI’s recently released ChatGPT. I found this concise description of ChatGPT:
A large language model trained by OpenAI is a machine learning model that has been trained on a large dataset of natural language text, typically using a deep learning approach. This allows the model to learn the patterns and structures of human language and to generate text that is similar in style and content to human-generated text.
You can sign-up to try it for yourself here.
This is a Twitter thread of prompts I’ve given it and its responses. Everything from a Kelly Betting problem to imagining if DMX wrote the hook for No Scrubs.
I also gave the bot a condensed version of the riddle.
Prompt: If I have a 31 inch silver bar but I need to make the minimum number of cuts so I can create a new bar any length up to 31 inches, how many cuts do I need?
To create a bar of any length up to 31 inches, you would need to make five cuts to your silver bar. This is because the minimum number of cuts required to create a bar of any length up to a given length is equal to the log base 2 of that length, rounded up to the nearest whole number. In this case, the log base 2 of 31 is 4.8, which rounds up to 5. Therefore, you would need to make five cuts to your silver bar to create a new bar of any length up to 31 inches.
“log base 2”?! It knew it was a problem for binary.
Lacking the vision to peer around corners, my small mind can only see the 6 inches in front of my face. And I can see turning to ChatGPT over Google for many types of searches. But with the explosion of “generative AI” in the past year (GPT engines, Dall-E, Stable Diffusion or Midjourney for images), it’s clear the times they are a-changin’