Series that don't have 3s
May 19, 2022
My 2019 attempt to make a series that has every third element and otherwise.
Backstory
One of the last math topics we did in 9th grade (3º de la ESO) was series. My math teacher at the time (Marta) put up the challenge of coming up with a series that is just like , except every third number it has to be . I, of course, took the challenge. However, I couldn’t have expected how interesting this problem would end up being. Here I’ve compiled all the solutions I came up with back in 2019.
Solutions
1. Sines
The function is cyclic, so it makes sense to use it. We can adjust its phase to thirds by multiplying by :
However, I used back then and, while it certainly is a questionable choice, I will respect it today.
Thus, we have , , , …
We can normalize these values by multiplying by the reciprocals, :
To get , , , …
And then we can square to get the correct signs:
So if we just multiply by the index, , we have our series!
It’s interesting to note that this method wouldn’t work so nicely with periods other than 3. We were lucky that the magnitude of the reciprocal is the same for the two values that weren’t 0 (and we couldn’t just divide because we would have a problem with ).
Once I presented this solution to my teacher, she proposed to me a new challenge: sines (and any basic cyclic functions) are banned. What to do now?
2. Complex numbers
Actually, there is quite a simple workaround, but it’s kind of cheesy.
We know that complex numbers can be expressed as
If they have an argument of . So, if we just take the imaginary part of , we have a sine:
And this way we can substitute our previous result.
3. Check multiples
Let’s try to solve it cleanly, with the definition of multples.
A number is said to be a multiple of if:
So if we’re searching for positive multples of 3, we want the following condition:
The expression implies . However, we don’t know value of , so what could we do?
Well, we can just try all of the values of . If (and only if) is actually a multiple of the previous difference will be . If we take the product of all the differences, we will have a when is a multiple of and a different number otherwise.
Things are going to get messy, so let’s call this product :
Now we have for multiples of 3 and some large product otherwise. Therefore, we have to find some way to leverage some special property that has.
One such property is that . The only other number that has as its factorial is , but if we just multiply by we will have our desired effect. We should also square it to avoid getting the gamma definition of the factorial when applied to negative numbers.
This way, not only every other number will not return , it will return an even number (since every factorial after has a factor of ). To summirize:
Now we can use a property of the parity of numbers. Namely, the fact that and . We can reduce to the odd case by adding and, since that will retun on the even case, we can divide by . Thus we have a solution:
It’s easy to see that the product will never have to go past (or even ). I find the infinity more mathematically aesthetic, but I used on the implementation. Also, we have to reduce the product because we are taking a hilariously big factorial which will never be able to compute after a certain point. We can do this because we can prove that the parity is the only important aspect and will remain the same.
This solution very easy to modify for other periods (just replace the !) and probably the cleanest.
4. Subtraction
Another approach is to cyclify our series, by substracting every third element.
Let’s try to subtract after the third element just once. We can separate values bigger and smaller than by subtracting… . It’s quite ugly, but this way we have negative values between and and positive values afterwards.
We can extract the sign of a value if we do , where , to avoid using less conventional notation.
We can do the same thing as for solution to convert these values into before and after:
So if subtract that to we would have , , , , , , , …
We have the same series, but shifted over by ! This means we can do the same thing but for . Then we would have to do the same but for , then , etc…
So we have sum where the general term is . As we only care for the sign and not the magnitude, we can de-uglify the expresion by multiplying by . This way, the expresion is as follows:
The expression returns , , , , , , … indefinitely.
The easiest way to make it have every third element is to subtract , offset it and do the same thing as with the sines. Back in the day for some reason I did it using factorials. The expression in question is the following:
There’s no justification for this last step other than “it just kinda works”.
5. Unbeknownst recursion
The previous solution was very recursive in nature. Could we just use recursion?
This is the last, and might be the most interesting. Looking back, I’m very surprised, since I hadn’t heard of recursion back then and I was kinda redescovering it myself.
Let’s take
Which is useful, because:
As before, this is the start of a counter that goes , , , , , , , , … So this counter works until .
One way to extend it is to “change” the . More precisely, if we input numbers between and to , then it’s going to work. The thing is that provides numbers between and until !
Remember that was defined as:
So is:
We can then input into to get it to work until :
And now the recursive nature is becoming apparent. Let’s call the recursive counter, :
There is still one small problem. This recursion, as it stands, is infinte; any implementation would stack overflow. The easy solution is to define something like . However, we can just prove it!
Proof
First, observe that is always either or . This means that is always or , which in turn implies that is always or .
Using this, we can deduce that , since or and both satisy this condition.
Now, according to the definition of , the value of is the following:
We know that can be, at most, . However, any value less than will evaluate to in . This means that
QED.
So, finally, we can make the last series using the counter, and the same approach used in solution 4:
Isn’t it beautiful?
Epilogue
This is the technical part of this project, but in 2020 I also made a video (in spanish) of my journey to get to the solutions. Finally, I’ve implemented this in a Pluto notebook written in Julia.