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

I am trying to come up with an equation that describes groups of three. I have one limitation though, which is that I have to use an ever increasing value of n + 1 for each iteration. Not sure if this is possible.

So for example:

when n = x : result y

n = 1 : 1  (first set of three)
n = 2 : 2
n = 3 : 3 
n = 4 : 7  (second set of three)
n = 5 : 8
n = 6 : 9   
n = 7 : 13  (continues...)

The limitation is for a computer program that selects rows. I can provide it with an equation that consists of one variable, n. I would really appreciate not just an answer, but a short explanation of how to tackle it.

share|cite|improve this question
@RossMillikan - yes, that is exactly it. Sorry if it wasn't clear. – mrtsherman Nov 16 '11 at 2:54
up vote 4 down vote accepted

Do you want to skip three between groups? The first group would be 1,2,3, skip 4,5,6, second group 7,8,9, skip 10,11,12, third group 13,14,15 and so on? If so you have $3\lfloor\frac{n-1}{3}\rfloor+n$

share|cite|improve this answer
@mrtsherman: To find this, I thought about needing a jump of 3 when n was 1 more than a multiple of 3. – Ross Millikan Nov 16 '11 at 3:13

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.