Open Source · 7 Languages · 900+ Problems

Project Euler Solutions

Complete solutions in C++, Python & Java — with step-by-step mathematical explanations

All Problems

Problem 836: A Bold Proposition

View on Project Euler

Project Euler Problem 836 Solution

EulerSolve provides an optimized solution for Project Euler Problem 836, A Bold Proposition, with C++, Python, Java, and a step-by-step mathematical explanation.

Problem Summary Problem 836 is not a large-scale numerical search. The statement hides its answer inside a fixed ordered list of bold mathematical words. The task is to read those words in order, take the first letter of each one, normalize the letter to lowercase, and concatenate the letters into a single string. Because the word list is fixed, there is no optimization, no branching search, and no number-theoretic trick. The entire challenge is recognizing the correct deterministic extraction rule and applying it without disturbing the original order of the words. Mathematical Approach Let the ordered word list be affine, plane, radically, integral, local, field, open, oriented, line, section, jacobian, orthogonal, kernel, embedding . Write this as $W=(w_1,w_2,\dots,w_{14}).$ For each word define the extracted character by $c_i=\operatorname{lower}(\operatorname{first}(w_i)).$ The target answer is then $A=c_1c_2\cdots c_{14}.$ Step 1: Preserve the Given Order The order of the words is part of the data. If the words were rearranged, the resulting string would change, so the solution must treat the list as an ordered 14-tuple rather than as an unordered set. In symbols, the extraction is positional: the contribution of \(w_i\) must become the \(i\)-th character of the output....

Detailed mathematical approach

Problem Summary

Problem 836 is not a large-scale numerical search. The statement hides its answer inside a fixed ordered list of bold mathematical words. The task is to read those words in order, take the first letter of each one, normalize the letter to lowercase, and concatenate the letters into a single string.

Because the word list is fixed, there is no optimization, no branching search, and no number-theoretic trick. The entire challenge is recognizing the correct deterministic extraction rule and applying it without disturbing the original order of the words.

Mathematical Approach

Let the ordered word list be

affine, plane, radically, integral, local, field, open, oriented, line, section, jacobian, orthogonal, kernel, embedding.

Write this as

$W=(w_1,w_2,\dots,w_{14}).$

For each word define the extracted character by

$c_i=\operatorname{lower}(\operatorname{first}(w_i)).$

The target answer is then

$A=c_1c_2\cdots c_{14}.$

Step 1: Preserve the Given Order

The order of the words is part of the data. If the words were rearranged, the resulting string would change, so the solution must treat the list as an ordered 14-tuple rather than as an unordered set.

In symbols, the extraction is positional: the contribution of \(w_i\) must become the \(i\)-th character of the output.

Step 2: Apply the Initial-Letter Map

Each word contributes exactly one character, namely its first letter. Lowercasing makes the mapping uniform even if the source text had mixed capitalization. Formally, the map

$w_i\longmapsto c_i=\operatorname{lower}(\operatorname{first}(w_i))$

sends every non-empty word to one lowercase character.

Since all 14 source words are non-empty, the map is well-defined for every entry of the list.

Step 3: Evaluate the Characters One by One

Applying the rule to the 14 words gives

$\begin{aligned} c_1&=a,& c_2&=p,& c_3&=r,& c_4&=i,& c_5&=l,\\ c_6&=f,& c_7&=o,& c_8&=o,& c_9&=l,& c_{10}&=s,\\ c_{11}&=j,& c_{12}&=o,& c_{13}&=k,& c_{14}&=e. \end{aligned}$

So the extracted character sequence is

$\left(a,p,r,i,l,f,o,o,l,s,j,o,k,e\right).$

Step 4: Concatenate the Sequence

Now concatenate the characters in the same order:

$A=c_1c_2\cdots c_{14}=\text{aprilfoolsjoke}.$

A useful way to see the structure is to group the letters into natural chunks:

$A=\underbrace{\text{april}}_{1-5}\underbrace{\text{fools}}_{6-10}\underbrace{\text{joke}}_{11-14}.$

Thus the hidden message is the phrase “aprilfoolsjoke”.

Step 5: Why This Completely Solves the Problem

There is only one ordered list and only one deterministic rule. Every index contributes exactly one lowercase initial, and concatenation preserves order. Therefore the resulting string is unique, and no alternative interpretation is needed once the extraction rule is identified.

Mathematically, this is a direct composition of three simple functions: ordered lookup, first-character extraction, and lowercase normalization, followed by concatenation.

Worked Example

Take the first five words:

affine, plane, radically, integral, local.

Their initials are \(a,p,r,i,l\), so they already form

$\text{april}.$

The next five words,

field, open, oriented, line, section,

produce \(f,o,o,l,s\), which gives

$\text{fools}.$

The last four words,

jacobian, orthogonal, kernel, embedding,

produce \(j,o,k,e\), which gives

$\text{joke}.$

Combining the three groups yields

$\text{april}+\text{fools}+\text{joke}=\text{aprilfoolsjoke}.$

How the Code Works

The C++, Python, and Java implementations all use the same fixed ordered list of 14 words. They perform a single left-to-right pass over that list, read the first character of each word, convert it to lowercase, and append it to an output string.

One implementation also includes a sanity check that each word is non-empty before reading its initial. After the pass finishes, the implementation prints or returns the concatenated result “aprilfoolsjoke”. The code is therefore a direct transcription of the mathematical mapping above rather than a search procedure.

Complexity Analysis

If the problem is written in general form for \(n\) words with total text length \(L\), then extracting one initial per word takes \(O(n)\) time after tokenization, or \(O(L)\) if the parsing step is counted. Building the output string needs \(O(n)\) space.

For the actual Project Euler instance, \(n=14\) is fixed in advance. That means the real running time and extra memory usage are both constant: \(O(1)\).

Footnotes and References

  1. Problem page: https://projecteuler.net/problem=836
  2. Acrostic: Wikipedia - Acrostic
  3. Initialism: Wikipedia - Initialism
  4. String concatenation: Wikipedia - String concatenation
  5. Letter case: Wikipedia - Letter case

Mathematical approach · C++ solution · Python solution · Java solution

Previous: Problem 835 · All Project Euler solutions · Next: Problem 837

Need help with a problem? Ask me! 💡
e
✦ Euler GLM 5.2
Hi! I'm Euler. Ask me anything about Project Euler problems, math concepts, or solution approaches! 🧮