How to solve number series with $f(n) = n^2 + 1$

Let's say I have this series of numbers 2, 5, 10, 17. Now somebody told me that next number is 26. He used this function for that:

f(n) = n*n + 1


Can anyone explain how does that function solve the problem to come up with 26?

-
Look them up on the OEIS. These types of puzzles are pointless, especially when their solutions are non-mathematical. –  Qiaochu Yuan Nov 7 '10 at 12:55
This type of puzzle is never mathematical. –  anon Nov 7 '10 at 12:56
For OEIS, see research.att.com/njas/sequences . By definition, no matter how the sequence begins, the following numbers can be arbitrary. –  Jaska Nov 7 '10 at 13:07
@muad: that's not entirely true. Here is my favorite such problem, which has a totally mathematical solution, but is (in my opinion) impossible to guess unless you've seen it before: 1, infinity, 5, 6, 3, 3, ? –  Qiaochu Yuan Nov 7 '10 at 13:20
@Qiaochu: haven't seen it, but regular solids? –  Ross Millikan Nov 7 '10 at 14:52

In general given any length $n$ sequence of numbers there exists a polynomial $p(x)$ of degree $n$ which gives this sequence. It's easy to find such a polynomial so I will not discuss how to do this. Note that as a consequence of this, if we are given a length $n$ sequence we can find a polynomial for the length $n+1$ sequence which gives any value we want after giving the values in the initial sequence.

Futhermore, there are many different types of function other than polynomials - many of which can fit any given sequence. For this reason it is impossible to really be "right" when answering a question of the form "What's the next number ...?". Any prediction is just as (in)valid without putting some constraints on it.

-
"What's the next number ...?". Any prediction is just as (in)valid without putting some constraints on it. I usually face more than one question in my aptitude module just like this .. and they hope for a correct answer!? :( –  Quixotic Nov 7 '10 at 14:02
@Debanjan, yes you just have to humor these people. –  anon Nov 7 '10 at 14:42

Take the position of the number. First is 1, second is 2 and so on.

So we have

$$1\cdot 1+1 = 2,\\ 2\cdot 2+1 = 5, \\ 3\cdot 3+1 = 10, \\ 4\cdot 4+1 = 17, \\ 5 \cdot 5+1 = 26$$

The tenth number in the sequence would be $$10\cdot 10+1 = 101.$$

-

It just goes like by just lookin at the question i get to know that the number is increasing which means something is being added. the number next to 2 is 5 which means 2+3=5 Now, by trying 5+3 i get 8 but the number coming up is 10 and we know that adding 5 to 5 will give me 10 so I concluded, skip and add the number 2+3=5 5+5(skipping 4) =10 now next to 5 comes 6 which we have to skip 10+7=17 17+9= 26. which is the answer. It took less than a minute figuring it out :) hope it helps

-
I think this should be re-written to be less chatty, as it is very confusing. –  Simon Hayward Nov 26 '12 at 10:01
I thought the answer was amusing –  tacos_tacos_tacos Dec 5 '12 at 7:36