Find the exact value of the following expression:
\[1 \times \frac{1}{4} + \left(1 + \frac{1}{4} \right) \times \frac{1}{9} + \left(1 + \frac{1}{4} + \frac{1}{9} \right) \times \frac{1}{16} + \dots\]
I sought ways of manipulating numbers, coming up with the following a few years back:
Given a list of numbers, repeat this procedure for all terms and return the sum.
For all terms, sum the previous terms and multiply that with the term itself.
An example: [3, 3, 4] would result to 3 x 3 + (3 + 3) x 4 = 33. [1, 2, 3, 4] would be 1 x 2 + 3 x 3 + 6 x 4 = 35.
Lists with fewer than two terms are considered to result in 0. (This is not particularly interesting)
One property of this that quickly arose is that the order of the terms does not matter. e.g. [3, 3, 4] is equivalent to [4, 3, 3].
There are some quirky operations related to partitioning an element, modifying the list while keeping the sum the same, e.g. [3, 3, 4] + 2x2 + 1x2 - 3x1 + 2x2 → [3, 3, 2, 2] + 1x2 - 3x1 + 2x2→ [3, 1, 2, 2, 2] - 3x1 + 2x2 → [4, 2, 2, 2] + 2x2 → [2, 2, 2, 2, 2]
Below are a couple of problems that would hopefully prove interesting. Solutions follow. Level of complexity are relative to each other only.
Level 1
What happens to the result when I multiply all the terms in the list by n?
Implement in Python (sorry not sorry) the function Lolly, which takes in a list 'lst' and calculates its value as done above, given the following template.
*This is not the best implementation, as we shall see, but makes more sense immediately given the above definition.
def Lolly(lst):
"""
>>> Lolly([2, 1, 6])
20
"""
if __________:
return __________
return Lolly(__________) + __________
Level 2
It was not long before I experimented with infinite sequences. Find the result of the procedure applied to the infinite geometric progression with 1 as the first element and 0.5 as the ratio, i.e. [1, 0.5, 0.25, ...].
- Optional: Generalise this result with a as the first element and 1/r as the ratio.
Level 3
The generalised result from above is only valid for |1/r| < 1 that allows convergence. Find the result of the procedure applied to the finite geometric progression with 1 as the first element and 10 as the ratio, up until the nth term = 10^(n - 1).
- Optional: Generalise this result with a as the first element, 1/r as the ratio, up to n terms.
solutions
Everything revolves around the definitions made.
Level 1
The result is scaled by n squared. This is evident when you expand the expression algebraically, each term being a product of two elements - multiplying each individual element by n is equivalent to multiplying n squared to the entire expression.
We will revisit this with another explanation from a slightly different point of view.
This is quite straightforward.
def Lolly(lst):
if len(lst) < 2:
return 0
return Lolly(lst[1:]) + lst[0] * sum(lst[1:])
Level 2
There is no trick other than to simply attempt this algebraically (yet).
===1×21+(1+21)×41+(1+21+41)×81+…1×(21+41+81+…)+21×(41+81+161+…)+41×(81+161+321+…)+…(21+41+81+…)×(1+41+161+…)34
- Optional part, essentially identical
===a×ra+(a+ra)×r2a+(a+ra+r2a)×r3a+…a×(ra+r2a+r3a+…)+ra×(r2a+r3a+r4a+…)+r2a×(r3a+r4a+r5a+…)+…(ra+r2a+r3a+…)×(a+r2a+r4a+…)(r−1)2(r+1)a2r2
Level 3
=====1×10+(1+10)×100+(1+10+100)×1000+⋯+(1+10+100+⋯+10n−2)×10n−11×(10+100+1000+⋯+10n−1)+10×(100+1000+10000+⋯+10n−1)+⋯+10n−3×(10n−2+10n−1)+102n−3910n−10+10×910n−100+⋯+10n−3×910n−10n−2+10n−2×910n−10n−1910n×(1+10+100+⋯+10n−2)−910×(1+102+1002+⋯+102n−4)910n×910n−1−1−910×99100n−1−1891(10n−10)(10n−1)
=====a×ra+(a+ra)×r2a+(a+ra+r2a)×r3a+⋯+(a+ra+r2a+⋯+rn−2a)×rn−1aa×(ra+r2a+r3a+⋯+rn−1a)+ra×(r2a+r3a+r4a+⋯+rn−1a)+⋯+rn−3a×(rn−2a+rn−1a)+r2n−3a21−ra2r1−n−a2+1−ra2r−n−a2r−2+⋯+1−ra2r4−2n−a2r6−2n+1−ra2r3−2n−a2r4−2n1−ra2r1−n(1+r−1+r−2+⋯+r2−n)−1−ra2(1+r−2+r−4+⋯+r4−2n)1−ra2r1−n×1−rr2−n−r−1−ra2×1−r2r4−2n−r2(r−1)2(r+1)a2r2−2n(rn−1)(rn−r)
Probably faster would be to reuse the result from Level 2.
Before I continue, allow me to introduce the actual name of this construct - this is known as the 2nd elementary symmetric polynomial, as I had recently discovered (to my disappointment that someone beat me to it).
We continue with one more problem.
Level 4
This part is crucial. We revisit the definition. With all things considered, find a more convenient way to find the result from the procedure given some list. Implement newLolly with the same behaviour as Lolly with the following template.
def newLolly(lst):
return __________ #lol good luck
solution
Eventually Python refused to comply when the recursion limit was reached (frequently). I was forced to come up with some way to speed up the process and prevent Python from stopping altogether.
We can represent a product by a rectangle where the sides are the multiplicands. With the expressions from this procedure, one can construct a staircase out of these rectangles.
3 3 4 each X represents a rectangle
3|
3|X 3x3
4|X X 3x4 + 3x4
[3, 3, 4] = 33
1 2 1 2
1|
2|X 1x2
1|X X 1x1 + 2x1
2|X X X 2x1 + 2x2 + 2x1
[1, 2, 1, 2] = 13
But wait! I have just constructed a square with the diagonal and the other half taken out, the side length of the square being the sum of all elements in the list.
So it turns out that the result is equivalent to the square of the sum of all the elements in the list subtracted by the square of each element all divided by 2.
def newLolly(lst):
return (sum(lst) ** 2 - sum([i ** 2 for i in lst])) / 2
In the problems of Levels 2 and 3, the first step in both solutions is merely grouping rectangles in a different way, horizontally to vertically.
On a side note, changing the order of elements in a list is like moving rectangles and doesn't change the area.
All the above is likely the same as this.
With a similar setup, this can be extended to higher order elementary symmetric polynomials using cubes (3rd) / hypercubes.
Let's revisit the previous problems with all of this in mind.
Level 1
- Think of the square. Multiplying all lengths by n is equivalent to scaling all areas by n squared. It follows naturally that the result is scaled by n squared.
Level 2
We now attempt this problem with the new method.
==21[(1+21+41+…)2−(1+221+421+…)]21[4−34]34
==21[(a+ra+r2a+…)2−(a2+r2a2+r4a2+…)]21[(r−1)2a2r2−r2−1a2r2](r−1)2(r+1)a2r2
Level 3
==21[(1+10+100+⋯+10n−1)2−(1+102+1002+⋯+102n−2)]21[81(10n−1)2−99100n−1]891(10n−10)(10n−1)
Armed with the new weapon, we return to the very first problem.
Level 5
Find the exact value of the following expression:
1×41+(1+41)×91+(1+41+91)×161+…
solution
To manipulate this algebraically to find the answer is not easy, but notice that this is just [1, 1/4, 1/9, ...] expanded. The previous method is applicable (paired with assumed knowledge of z(2) and z(4)).
==21[(1+221+321+…)2−(1+241+341+…)]21[36π4−90π4]120π4
What's next?
Play with what we have! Plug in diverging sequences, investigate other kinds of sequences, all the good stuff.
extras
Find out what's wrong with this OEIS entry. (photo taken at the time of writing, corrections are being made and published soon)
Implement invLolly(n) which returns the list of 'multisets' as described in A260903; len(invLolly(n)) should return a(n). (This is my rather basic and easy-to-understand implementation, probably not the fastest but better than nothing; a PARI program written by Andrew Howroyd will be made available on the OEIS page.)
def invLolly(n):
"""
>>> invLolly(24)
[[1, 1, 1, 2, 3], [1, 1, 1, 7], [1, 4, 4], [1, 24], [2, 2, 2, 2], [2, 2, 5], [2, 12], [3, 8], [4, 6]]
>>> len(invLolly(900))
3214
"""
current = [1]
reps = []
while __________:
while __________:
current.append(__________)
if __________:
reps.append(__________)
__________ = __________
return reps
#Algebra
Easy Math Editor
This discussion board is a place to discuss our Daily Challenges and the math and science related to those challenges. Explanations are more than just a solution — they should explain the steps and thinking strategies that you used to obtain the solution. Comments should further the discussion of math and science.
When posting on Brilliant:
*italics*
or_italics_
**bold**
or__bold__
paragraph 1
paragraph 2
[example link](https://brilliant.org)
> This is a quote
\(
...\)
or\[
...\]
to ensure proper formatting.2 \times 3
2^{34}
a_{i-1}
\frac{2}{3}
\sqrt{2}
\sum_{i=1}^3
\sin \theta
\boxed{123}
Comments
This hard exercise badly affects my mood. I am already tired of difficult tasks in college and therefore I use the help of professionals. I read the best persuasive essay topics and can use them for my assignments.