Thursday, 25 June 2026

Reverse Engineering Part 3

In my previous post, Reverse Engineering Part 2, I ended up being quite satisfied with the reverse engineering that created as output an homogenous linear recurrence relation of order 3 after input of any positive integer greater than 9. I used 28206 and 28207 as examples to illustrate the process.

This got me thinking about creating as output an homogenous linear recurrence relation of order 2 after input of any positive integer greater than 9. I explained in my post Reverse Engineering Part 1 that Gemini's algorithm had failed when attempting this. I was trying to get Gemini to create the following:$$ \begin{align} &\text{a}(n)=p \times \text{a}(n-1)+q \times \text{a}(n-2) \\ &\text{where} -9 \leq p,q \leq 9 \text{ with } p \neq 0 \text{ and } q \neq 0 \\ &\text{ and } 0 \leq \text{a}(n-1), \text{a}(n-2) \leq 9 \end{align}$$So I asked Gemini to relax the conditions by specifying that \( |p + q|\) should be as small as possible. When applied to 28207 this produced values \(p=39\) and \(q=-38\). Not quite what I wanted. So in the end I specified that \(|p^2+q^2+a(0)^2+a(1)^2|\) should be as small as possible. Applied to 28206, this was the result (permalink):

Target Number: 28206
--------------------------------------------------
Constants found: p = 13, q = 1
Constraint check: Minimum p^2 + q^2 + a(0)^2 + a(1)^2 = 395
Seed numbers:    a(0) = 9, a(1) = 12
--------------------------------------------------
Sequence progression:
  a(0) = 9
  a(1) = 12
  a(2) = 165
  a(3) = 2157
  a(4) = 28206
--------------------------------------------------
Comma-separated sequence:
9, 12, 165, 2157, 28206

Applied to 28207, this was the result (permalink):

 Target Number: 28207

--------------------------------------------------
Constants found: p = 6, q = 5
Constraint check: Minimum p^2 + q^2 + a(0)^2 + a(1)^2 = 231
Seed numbers:    a(0) = 11, a(1) = 7
--------------------------------------------------
Sequence progression:
  a(0) = 11
  a(1) = 7
  a(2) = 97
  a(3) = 617
  a(4) = 4187
  a(5) = 28207
--------------------------------------------------
Comma-separated sequence:
11, 7, 97, 617, 4187, 28207

Overall I'm quite happy with these sequences. All terms are positive, the coefficients and seed values are not large and the terms increase steadily toward their targets, avoiding any wild gyrations. I have incorporated this program into my daily number analysis. 

No comments:

Post a Comment