A seller has some quantity of rice with him. The seller offered his customer that if he/she buys half of the rice he has, he will give half kg of rice as a discount. The first customer accepts his offer and he purchased half of the rice and get half kg as extra. After selling the rice to the first customer he again makes the same offer for the second customer, and so on. The seller left with no quantity of rice after he made the fifth transaction.
Q. The initial quantity of rice the seller had?
Let us calculate the total kg of rice which seller has before each customer came for purchasing.
- Before fifth customer: (1/2 kg as a discount)*2 = 1
So before dealing with fifth customer seller should have 1kg.
- Before fourth customer: (1+(1/2 as a discount))*2 = 3
So before dealing with fourth customer seller should have 3kg.
- Before third customer: (3+(1/2 kg as a discount))*2 = 7
So before dealing with third customer seller should have 7 kg.
- Before second customer: (7+(1/2 as a discount))*2 = 15
So before dealing with second customer seller should have 15 kg.
- Before First customer: (15+(1/2 kg as a discount))*2 = 31
So before dealing with first customer seller should have 31 kg.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.