FindSequenceFunction[{20, 24, 28, 32, 36, 40}]

New in version 7. This functionality is one of the reasons I used Maple several years ago.

A related function is "RootApproximant" which tries to find an algebraic number approximating a given real.

Here's a tricky one -- number of regions in 4-space formed by n-1 hyperplanes. It starts with

1,2,4,8,16

Mathematica incorrectly guesses 2^n

Next term of the sequence is 31, if you include that term, it gives the correct formula

Given the first 5 terms I would say that Mathematica is correct when it returned 2^n since that's the simplest formula that fits the given data.

ReplyDeleteIt's a very nice function - If only I had it when I was in high school :)