Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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|improve this question
@RossMillikan - yes, that is exactly it. Sorry if it wasn't clear. –  mrtsherman Nov 16 '11 at 2:54

1 Answer 1

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|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.