Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there any tool to get math sequence given the first few elements of the sequence.

I am trying to solve a few problems from projecteuler. I am looking for a math tool that can generate me a sequence formula.

Example given inputs like

5, 7, 9, 11, 13.....

The tool should detect its an arithmetic progression and give me following

a(n) = 5 + (n-1) 2 

A more complicated example would be from the link I provided above

1, 3, 5, 7, 9, 13, 17, 21, 25 .....
share|cite|improve this question
Wouldn't it be better to figure out the pattern yourself, then use the pattern to come up with an equation? Exactly what kinds of sequences is it supposed to solve? Arithmetic? Geometric? Arithmetic-geometric? – Mike Feb 3 '13 at 8:18
up vote 1 down vote accepted

Is the on-line encyclopedia of integer sequences good enough?

share|cite|improve this answer
Thanks for this... – Kamath Feb 3 '13 at 8:30

A general strategy for determining patterns in sequences like the ones you show here is to analyze differences as follows. Consider your more complicated sequence:

$$1, 3, 5, 7, 9, 13, 17, 21, 25, \ldots$$

The first difference here is

$$2, 2, 2, 2, 4, 4, 4, 4, \ldots$$

So we see a constant difference, then a jump to another constant difference. You can see this even more clearly by taking the difference of the difference:

$$0, 0, 0, 2, 0, 0, 0, \ldots$$

A better example, though is a smooth one, like the squares of the integers:

$$1, 4, 9, 16, 25, 36, 49, 64 \ldots$$

The first difference is

$$3, 5, 7, 9, 11, 13, 15, \ldots$$

which you can see is a linear sequence. The second difference

$$2, 2, 2, 2, 2, 2, \ldots$$

is a constant sequence, which is characteristic of a sequence that increases quadratically. You can play around with all sorts of such sequences and see how their differences behave.

Taking further differences will not lead to a set of zeroes because of the isolated jump. So we can say that we have a discontinuity in the sequence away from which we have two linear subsequences.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.