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've got a sequence defined as such:

  • between 0 and 5, $i = 1$
  • between 6 and 10, $i = 1*d$
  • between 11 and 15, $i = 1*d^2$
  • between 16 and 20, $i = 1*d^3$
  • ...

I guess I could write it like this for n=5:

between $k(n)+1$ and $(k+1)n$, $i= 1*d^k$

and I'm looking for the nth term of the induced serie. (ie the sum of the Nth first terms of my sequence)

Actually, I'm trying to solve a real-world problem here. We're selling products with a progressive discount (eg the first 5 items are at full price, then the 5 following items have a 10% discount, then there's an extra 10 percent discount for the next clip of 5, etc).

So far I'm handling this kind of manually (basically, I've created a table with all the possible values up to 1000 - we're not selling Lamborghini's, but still we don't expect a single customer to buy more than 1000 item from us, ever), and I'm quite curious to know how one would solve this using a single math formula.

share|improve this question
Quite a discount! If the regular price of an item is $100$ dollars, then when you get to around three hundred items, the last five are about $2$ cents each, an interesting instance of the magic of compounding. On a more serious note, you could generate a formula for determining total cost if $n$ items are bought instead of unit prices. It is a small variant of summing a (finite) geometric series. –  André Nicolas Jul 17 '11 at 15:10
add comment

2 Answers

The sequence is $$d^{\lfloor (n-1)/5 \rfloor}, \text{ } n=1,2,3,\dots$$ See http://en.wikipedia.org/wiki/Floor_and_ceiling_functions. Note I didn't include $n=0$ because that doesn't fit the pattern of the rest of your sequence. (There are 6 numbers between 0 and 5 exclusive, unlike 5 numbers in all the other intervals.)

share|improve this answer
Thanks for clarifying what the sequence was ; I'm still looking for the sum of the Nth first terms, and I'm a bit stuck because of this flooring thing ... –  Brann Jul 17 '11 at 14:45
add comment

Answer corrected based on the comments below. The exponent of d is e

 e = 0 if n <= 5 
 e = (n - 1) div 5 if n > 5

In most programming languages the last statement is written as:

e = (n - 1) / 5
share|improve this answer
I think that you want e = (n-1) div 5. Or whatever is the integer division (rounded down to an integer) call in your language of choice –  Jyrki Lahtonen Jul 17 '11 at 9:51
@Jyrki: IIRC, with the languages these days, p/q for p and q both set to integer types would give integer results anyway. :) –  J. M. Jul 17 '11 at 10:05
You both are completely rigth. Thank you for the correction! I have corrected my answer. –  Jiri Jul 17 '11 at 10:20
add comment

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.