Preparation
Discover the logic behind of the of the challenge.
How I found it
So, my first discover was about the results, all were odd numbers, after that i tried to find a pattern in the results, because the results in the interval of 4 and 8 are exactly a sequence of odd numbers(1,3,5,7), but i found not much, at least, until my second discover, that was about some specific even numbers the result was always 1, after that, wasn't so hard to discover these numbers were potential of 2 and every time these numbers appears the result's sequential was interrupted and returned to one.
I already knew the potential of 2 will have 1 as results, and between these numbers the results will follow the odd numbers sequence(1,3,5,7...), so what i need is discover how many steps i have between the potential of 2. Using the formula n-2^(ROUND(LOG(n;2))) i can discover how many steps after the last potential, but even after i discover that, the results not match, so, i made my last discover, if i multiply the result of the first formula per 2 and add 1(just to turn the number into a odd number), the results will match. JUMPS OF JOY!!! \o/
Formula
2*(n-2^(ROUNDDOWN(LOG(n;2))))+1
I'm using ROUNDDONW instead ROUND because i noticed when i was using ROUND i had a problem with some numbers, in my tests in the interval between 21 and 31 the results were wrong, and after i modify the formula they were fixed
What I learned
A new math equation
Built With
- brain
- excel
- paper
- sweat
Log in or sign up for Devpost to join the conversation.