Self-referential language counting (I learned another word today bringing my total to fourteen words and twenty letters)
A recent XKCD caused some amusement: "Vocabulary update: I learned another word today, bringing my total to twelve".
We wondered whether there might be possible formulations of this joke that also contained the unique character count, so I wrote the following python script:
import num2word
import numpy
def find_self_reference():
sentence = "I learned another word today bringing my total to {0} words and {1} letters"
words = 12
for i in range(0, 1000):
num_word = num2word.word(i)
final_words = words + numpy.char.count(num_word, " ") + 1
final_num_words = (
int(final_words)
+ int(numpy.char.count(num2word.word(int(final_words)), " "))
+ 1
)
sentence_sub = sentence.format(num2word.word(final_num_words), num_word)
characters = len(set(sentence_sub.replace(" ", "")))
print(f"Needed {characters} characters but got {i}.")
if characters == i:
print(sentence_sub)
return
This gives us the following results:
- I learned another word today bringing my total to fourteen words and twenty letters
or
- Vocabulary update: I learned another word today bringing my total to seventeen words and twenty five letters
Good to have a hobby.
Self-referential language counting (I learned another word today bringing my total to fourteen words and twenty letters) was originally published by Martin Paul Eve at eve.gd: Martin Paul Eve on October 12, 2023.
Files
10.59348_sf2b0-q3k31.pdf
Files
(109.6 kB)
| Name | Size | Download all |
|---|---|---|
|
md5:49fbca2ec9b4508154dc3d484e5e1610
|
109.6 kB | Preview Download |
Additional details
Description
A recent XKCD caused some amusement: "Vocabulary update: I learned another word today, bringing my total to twelve". We wondered whether there might be possible formulations of this joke that also contained the unique character count, so I wrote the following python script: import num2word import numpy def find_self_reference(): sentence = "I learned another word today bringing my total to {0} words and {1} letters" words = 12 for i
Identifiers
- GUID
- https://doi.org/10.59348/sf2b0-q3k31
- URL
- https://eve.gd/2023/10/12/self-referential-language-counting/
Dates
- Issued
-
2023-10-11T00:00:00Z
- Updated
-
2023-10-11T23:00:00Z