bright-star
bright-star

Reputation: 6447

Is it possible to use recursive cell formulas in org-mode tables?

I'd like to build a column that begins with a constant, say, 1, and whose succeeding rows are double the preceding row (or some variable coefficient I set in the formula):

| 1  |
| 2  |
| 4  |
| 8  |
| 16 |

Is there a way to quickly set this up in Emacs? I see that there are row formulas, column formulas, and rectangular region formulas, but I don't see any recursion or quick formula replication in the manual.

Upvotes: 0

Views: 259

Answers (1)

Devin
Devin

Reputation: 88

#+TBLFM: @1$1=1::@<<..>$1=@-1 * 2

will produce that table recursively. Put the cursor on the last row and hit C-u C-u C-c * @<<..> is a range from second to the last row.

#+TBLFM: @1$1=0::@2$1=1::@<<<..>$1=@-1 + @-2

will produce the Fibonacci Sequence

Upvotes: 4

Related Questions