In my previous post Reverse Engineering Part 1, I had specified to Gemini that I wanted \(p + q + r \) to be the minimum possible within the specifications that each of these coefficients were to be between -9 and -9 inclusive. I was thinking in terms of the sum getting as close to zero as possible forgetting that the minimum possible sum would be -27. That's why I was getting coefficients in the output that were all negative. The algorithm was doing what I'd asked of it! What I should have instructed Gemini to do was to take the absolute value of \(p+q+r\). So to summarise, our starting point is:$$ \begin{align} &\text{a}(n)=p \times \text{a}(n-1)+q \times \text{a}(n-2) + r \times \text{a}(n-2)\\ &\text{with } -9 \leq p,q,r \leq 9, 0 \leq \text{a}(2), \text{a}(1),\text{a}(0) \leq 9 \\ &\text{and } |p+q+r| \text{ as close to zero as possible} \end{align}$$Having gotten Gemini to modify the algorithm, the result for 28206 becomes :$$ \begin{align} &\text{a}(n)=5 \times \text{a}(n-1)-7 \times \text{a}(n-2) + 2 \times \text{a}(n-2)\\ &a(0) = 2, a(1) = 2, a(2) = 6\end{align}$$The full details are (permalink):
Target Number: 28206------------------------------Constants found: p = 5, q = -7, r = 2Constraint check: Minimum |p + q + r| = 0 (Actual Sum = 0)Seed numbers: a(0) = 2, a(1) = 2, a(2) = 6------------------------------Sequence progression:a(0) = 2a(1) = 2a(2) = 6a(3) = 20a(4) = 62a(5) = 182a(6) = 516a(7) = 1430a(8) = 3902a(9) = 10532a(10) = 28206------------------------------Comma-separated sequence:2, 2, 6, 20, 62, 182, 516, 1430, 3902, 10532, 28206
This is a longer sequence than previously (2, 4, 2, -48, 408, -3390, 28206) but it has no negative members and is free of the wild gyrations that characterise the former. Similarly for 28207, we have (permalink):$$ \begin{align} &\text{a}(n)=5 \times \text{a}(n-1)+4 \times \text{a}(n-2) -8 \times \text{a}(n-2)\\ &a(0) = 1, a(1) = 1, a(2) = 7\end{align}$$The full results are (permalink):
Target Number: 28207------------------------------Constants found: p = 5, q = 4, r = -8Constraint check: Minimum |p + q + r| = 1 (Actual Sum = 1)Seed numbers: a(0) = 1, a(1) = 1, a(2) = 7------------------------------Sequence progression:a(0) = 1a(1) = 1a(2) = 7a(3) = 31a(4) = 175a(5) = 943a(6) = 5167a(7) = 28207------------------------------Comma-separated sequence:1, 1, 7, 31, 175, 943, 5167, 28207
This is shorter than the previously calculated sequence (3, 5, 1, -73, 243, -323, -311, 2207, -3445, -3595, 27729, -51001, -16797, 304365, -658279, 28207) and again it has no negative members and is free of the wild gyrations that characterise the former. So, a lesson learned. I've modified my daily number analysis algorithm accordingly.
No comments:
Post a Comment