Skip to content

Replace simple references to recursive functions in formulas #308

@ckrause

Description

@ckrause

The FormulaGenerator often generates simple auxiliary functions that call recursive functions. Here is program that generates such a formula:

; 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. Then we can get rid of the auxiliary helper functions.

Metadata

Metadata

Assignees

Labels

enhancementImprovement that is not a feature

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions