Identify these famous people by their initials (based on their full names), and explain the outlandish arithmetic used here. Whose initials should come at the question mark?
As hinted at by the title of this assignment, the background image and the reference to "outlandish" arithmetic, this puzzle concerns asteroids ("rocks") named after (fictional) famous people ("legends"). The bizarre sums in the question are correct when applied to the official numbers of these asteroids, according to the International Astronomical Union’s Minor Planet Center1.
In order, the sets of initials in the puzzle refer to the following individuals, with their initials indicated in green and the numbers and names of the asteroids named after them in parentheses:
William Shakespeare (2985 Shakespeare) + Johann Wolfgang von Goethe (3047 Goethe) = Alfred Bernhard Nobel (6032 Nobel)
Albert Einstein (2001 Einstein) + Charles Robert Darwin (1991 Darwin) = Wilhelm Richard Wagner (3992 Wagner)
Edmund Percival Hillary (3130 Hillary) + Hendrik Johannes Cruijff (14282 Cruijff) = Thomas Sean Connery (13070 Seanconnery) + Sigismund Schlomo Freud (4342 Freud)
Rembrandt Harmenszoon van Rijn (4511 Rembrandt) + Johannes Chrysostomus Wolfgangus Theophilus Mozart (1034 Mozartia) = Galileo Galilei (697 Galilea) + Tutankhamun (4848 Tutenchamun)
Bilbo Baggins (2991 Bilbo) + Johannes Gensfleisch zur Laden zum Gutenberg (777 Gutemberga) = Norma Jeane Mortenson (3768 Monroe)
Carl Edward Sagan (2709 Sagan) + Edwin Eugene Aldrin Jr (6470 Aldrin) = Louis Daniel Armstrong (9179 Satchmo)
Thomas Alva Edison (742 Edison) + Christopher Columbus (327 Columbia) = Max Karl Ernst Ludwig Planck (1069 Planckia)
Dmitri Ivanovich Mendeleev (2769 Mendeleev) + Christian Andreas Doppler (3905 Doppler) = Paul Cézanne (6674 Cézanne)
The person represented by the question mark is Prof. James Moriarty — the archenemy of Sherlock Holmes — since Johann Wolfgang von Goethe (3047 Goethe) + Albert Einstein (2001 Einstein) = James Moriarty (5048 Moriarty). This answer is particularly appropriate given the theme of the puzzle, as Prof. James Moriarty authored the fictional book The Dynamics of an Asteroid2.
We work with text files containing information about asteroids named after famous people. Each line of such a file describes one asteroid by four semicolons-separated (;) information fields: i) the unique number of the asteroid according to the International Astronomical Union’s Minor Planet Center3, ii) the unique name of the asteroid, iii) the full name of the person the asteroid was named after and iv) a short description of that person. For example, these are some lines from such a file (asteroids.txt4):
... 316020;Linshuhow;Jeremy Shu-How Lin;basketball player 316201;Malala;Malala Yousafzai;a Pakistani activist for female education 326290;Akhenaten;Akhenaten;a pharaoh of the 18th Dynasty of Egypt 327695;Yokoono;Yoko Ono;musician 337044;Bobdylan;Robert Allen Zimmerman;musician 342843;Davidbowie;David Robert Jones;musician 347940;Jorgezuluaga;Jorge I. Zuluaga Callejas;Colombian astronomer 365443;Holiday;Billie Holiday;jazz musician 374354;Pesquet;Thomas Gautier Pesquet;French astronaut 495181;Rogerwaters;George Roger Waters;musician, one of Pink Floyd founders 495253;Hanszimmer;Hans Florian Zimmer;a German composer 560354;Chrisnolan;Christopher Edward Nolan;film director
Your task:
Write a function initials that takes the full name (str) of a person. The function must return the initials (str) of that person, consisting of all letters in the person's full name that are not directly preceded by a letter.
Write a function read_asteroids that takes the location (str) of a text file containing information about asteroids named after famous people. The function must return a dictionary (dict) that maps the numbers (int) of all asteroids in the file onto a tuple (tuple) with two strings (str): i) the unique name of the asteroid and ii) the full name of the person the asteroid was named after. We call this the dictionary representation of the asteroids from the file.
Write a function group that takes the dictionary representation $$\mathcal{A}$$ of the asteroids from a file. The function must return a new dictionary (dict) that maps the initials (str) of each person in $$\mathcal{A}$$ onto a set (set) containing the numbers (int) of all asteroids in $$\mathcal{A}$$ that are named after persons with those initials. Use full names of persons to determine their initials.
Write a function rock_legends that takes three arguments: the initials $$i_1$$ and $$i_2$$ (str) of two persons, and the dictionary representation $$\mathcal{A}$$ of the asteroids from a file. The function must return a set (set) containing all asteroids in $$\mathcal{A}$$ whose number can be written as the sum of an asteroid in $$\mathcal{A}$$ that was named after a person with initials $$i_1$$ and the number of an asteroid in $$\mathcal{A}$$ that was named after a person with initials $$i_2$$. The function also has an optional parameter persons, taking a Boolean value (bool) that determines whether the asteroids in the set are represented by their name (False; default value) or by the full name of the person they are named after (True).
The text files in this assignment use the UTF-8 character encoding. This is now the default encoding on most computer systems (including Dodona). If encounter problems while reading files, you can explicitly specify the encoding when opening the files: encoding='utf-8'.
In the following interactive session we assume the text file asteroids.txt5 to be located in the current directory .
>>> initials('William Shakespeare')
'WS'
>>> initials('Johann Wolfgang von Goethe')
'JWvG'
>>> initials('Muḥammad ibn Mūsā al-Khwārizmī')
'MiMaK'
>>> asteroids = read_asteroids('asteroids.txt6')
>>> asteroids[2985]
('Shakespeare', 'William Shakespeare')
>>> asteroids[3047]
('Goethe', 'Johann Wolfgang von Goethe')
>>> asteroids[11156]
('Al-Khwarismi', 'Muḥammad ibn Mūsā al-Khwārizmī')
>>> init2aster = group(asteroids)
>>> init2aster['WS']
{2985, 31556}
>>> init2aster['JWvG']
{3047}
>>> init2aster['MiMaK']
{11156, 13498}
>>> rock_legends('WS', 'JWvG', asteroids)
{'Nobel'}
>>> rock_legends('DFJA', 'JS', asteroids, True)
{'Charles IV', 'David Morrison', 'Gregor Johann Mendel'}
>>> rock_legends('JP', 'JS', asteroids, persons=True)
{'Andrew Ferrari', 'Grace Patricia Kelly', 'James Francis Cagney Jr.', 'Lynn Rene Anderson'}
Strangely, asteroid 2309 Mr. Spock caused an uproar when its discoverer — James Gibson — revealed that he had actually named it after his cat (he called the cat Spock because it was "imperturbable, logical, intelligent, and had pointed ears"). The International Astronomical Union7 officially discouraged any more pet names, but people are still fine — asteroids have been named after Carlos Santana, James Bond, all four Beatles and all six members of Monty Python.
By the way, did you know that Brian Harold May8 — lead guitarist of the rock band Queen9 — earned a PhD degree in astrophysics from Imperial College London10 in 2007. From 2008–2013 he was Chancellor of Liverpool John Moores University11 and he was a "science team collaborator" with NASA's New Horizons12 Pluto mission. He is also a co-founder of the awareness campaign Asteroid Day13 and asteroid 52665 Brianmay14 was named after him.