What do these yellow boxes hide?
This image features the distinctive yellow-on-black styling used in the Star Wars1 opening crawl. Each item on the left of the image can be seen to be the name of a character created by George Lucas2 (or a simple abbreviation thereof).
This points us towards an integer sequence named after the French mathematician Édouard Lucas3 (1842–1891): the Lucas series. The first two Lucas numbers4 are $$L_0 = 2$$ and $$L_1 = 1$$. Each subsequent Lucas number is the sum of the two previous Lucas numbers. This yields the following integer sequence:
2, 1, 3, 4, 7, 11, 18, 29, 47, 76, …
The right side of the image encodes the whereabouts of George Lucas's characters in the Lucas series. To find where they are hiding, we first convert the name of the character into a digit string by replacing each letter in the name with its position in the alphabet (A=1, B=2, C=3, …, Z=26), keeping each digit in the name and removing any other character. For example, C-3P05 becomes 33160 (the concatenation of 3, 3, 16 and 0), LEIA6 becomes 12591, YODA7 becomes 251541, OBI-WAN8 becomes 152923114 and LUKE9 becomes 1221115.
As an illustration of how the whereabouts encode where the characters are hiding in the Lucas series, consider the second row featuring LEIA, whose name corresponds to the digit string 12591. The 933rd Lucas number (indicated by #933 in the whereabouts) happens to be the first of the Lucas numbers to contain the digit string 12591. This particular Lucas number has 195 digits (the last number in the whereabouts). If we then look at digits 147 to 151 (inclusive) of this 195-digit number (with the digits of an integer numbered from left to right starting from 1), we find that they read 12591 — precisely the digit string that corresponds to LEIA. For completeness, all 195 digits of the 933rd Lucas number are shown below, with the relevant digits highlighted in yellow:
967093252596168128267955063716512751689792563513532460758118
114022409095515128982546665404137717788421676297839636268638
282452765724593338741821541259157620134576677978005827300767
530434048847196
In other words, the whereabouts #933, 147-151 of 195 can be summarized as follows: the number preceded by the pound sign (#, in this case #933) denotes a particular Lucas number (namely the 933rd) and the rest of the whereabouts (in this case 147-151 of 195) indicates which digits of the given Lucas number should be extracted to give the digit string corresponding to the name (in this case 12591=LEIA).
By following the same technique, we can deduce that the yellow box on the fourth row must be a name with an encoding of 2214518. Although there are multiple strings of characters that map to this encoding, there is only one candidate that fits with the George Lucas theme — namely VADER10 (22-1-4-5-18).
The yellow boxes appearing on the final row of the image present a tougher challenge still, as we must determine which Lucas number to use. We already reveal that the first box hides the name INDIANA11, whose digit string 914491141 appears for the first time in the 123404th Lucas number. This Lucas number has 25790 digits, where the digit string 914491141 appears for the first time from position 8267 to position 8275. This yields the whereabouts #123404, 8267-8275 of 25790.
Write a function lucas_number that takes an integer $$n \in \mathbb{N}$$ (int). The function must return the $$n$$-th Lucas number $$L_n$$ (int).
Write a function fragment that takes three integers $$n, a, b \in \mathbb{N}$$ (int). The function must return the integer (int) formed by extracting digits $$a$$ to $$b$$ (inclusive) from the $$n$$-th Lucas number $$L_n$$, where digits in the Lucas number $$L_n$$ are numbered from left to right starting from 1.
Write a function digits that takes a name (str). The function must return the digit string (str) corresponding to the given name. No distinction should be made between uppercase and lowercase letters when determining the digit string.
Write a function whereabouts that takes a name (str). The function must return the whereabouts (str) that encode where the digit string corresponding to the given name appears for the first time in the Lucas series.
>>> lucas_number(10)
123
>>> lucas_number(20)
15127
>>> lucas_number(30)
1860498
>>> fragment(426, 39, 43)
33160
>>> fragment(933, 147, 151)
12591
>>> fragment(10454, 2062, 2070)
152923114
>>> digits('C-3P0')
'33160'
>>> digits('Leia')
'12591'
>>> digits('Obi-Wan')
'152923114'
>>> whereabouts('C-3P0')
'#426, 39-43 of 90'
>>> whereabouts('Leia')
'#933, 147-151 of 195'
>>> whereabouts('Obi-Wan')
'#10454, 2062-2070 of 2185'