loda-cpp icon indicating copy to clipboard operation
loda-cpp copied to clipboard

Replace simple references to recursive functions in formulas

Open ckrause opened this issue 2 years ago • 0 comments

Example:

; A266709: Coefficient of x in minimal polynomial of the continued fraction [2,1^n,2,1,1,...], where 1^n means n ones.
; Formula: a(n) = b(n+2), b(n) = 2*b(n-1)+2*b(n-2)-b(n-3), b(3) = -25, b(2) = -7, b(1) = -5, b(0) = 1

mov $2,1
add $0,2
lpb $0
  sub $0,1
  add $1,$2
  add $5,$1
  add $1,$2
  mov $3,$5
  sub $3,6
  mov $4,$2
  mov $2,$3
  mov $5,1
  add $5,$4
lpe
mov $0,$2

=> It would be nice to simplify the formula to a(n) = 2*a(n-1)+2*a(n-2)-a(n-3) with adjusted initial terms.

ckrause avatar Dec 28 '23 13:12 ckrause