1
$\begingroup$

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.

  • 0
    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.2011-07-17

2 Answers 2

3

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

  • 0
    My advice is do NOT use the floor function since it's not algebraric and will only bring trouble. Express it as a complex power.2016-11-26
1

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 
  • 0
    You both are comp$l$etely rigth. Thank you for the correction! I have corrected my answer.2011-07-17