A shopkeeper sells 1 toffee for 1 Rs. and gives an amazing exchange offer that you can buy 1 toffee by 3 empty toffee wrappers. If you have 1729 Rs., then at maximum how many toffees can you grab from the shopkeeper?
Note : Rs. represents Rupees (Indian Money Currency).
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Simple standard approach.
Actually, all this is done for your birthday. On your birthday, you plan to distribute toffees to the whole of your city (let with population 8000 people) , then how will you go for the equal distribution ? :P
Log in to reply
And then what's the probability of CAVITIES being caused ? :P
Log in to reply
Oh sir! Nice question, but that'll depend upon what type of teeth you will have, well if you want an absolute value here it is 0 . 0 6 1 1 0 0
P.S: Don't tell anyone that the value of probability is my D.O.B!
P.P.S: Sorry for a late reply, I am confined to a small screen, and FYI P.P.S literally means Post post script (said by @Andrei Golovanov in one of Nihar's questions.)
Log in to reply
@Sravanth C. – It's cool that your d.o.b. gives very less probability of having CAVITY.
So you were born on 06 November 0000. It's quite interesting. :P
Log in to reply
@Sandeep Bhardwaj – Oh yes! And a lot more interesting if we place 2 in front of all those 0 ′ s :P
Log in to reply
@Sravanth C. – hahahaha.. One doing so ,it will become 20000. then I'd ask : do you own a time machine ? :P
Log in to reply
@Sandeep Bhardwaj – And you might well ask, How can you comment! You must be V A N I S H E D ! ! ! Ha ha ha. . .
Nice question sir And 1729 is an amazing number.
I think that it is 2592 :(
Log in to reply
Can you explain your statement sir? ⌣ ¨
Log in to reply
1729 Toffees in 1729 Rs. then 576 toffees from 1728 wrappers .... 1 wrapper left then 192 toffees from 576 wrappers.... then 64 toffees from 192 wrappers then 21 toffees from 63 wrappers... 1 wrapper left then 7 toffees from 21 wrappers. Then 2 toffees from 6 wrappers ..... 1 wrapper left 1 toffee from 3 wrapper left... 1729+576+192+64+21+7+2+1=2592
Log in to reply
@Vasu Sharma – Ah! I see that you've committed a small mistake, can you correct yourself? ⌣ ¨
Log in to reply
@Sravanth C. – What? I cant understand your's?
Log in to reply
@Vasu Sharma – See that the question has asked "maximum number of chocolates the kid can buy". Your approach is absolutely fine, but there is another method to get more chocolates than yours(see my solution), I hope your doubt is clarified? ⌣ ¨
The answer is that with the given restrictions and the given exchange offer one can get 2593 sweets if one spends 1729 Rupees.
I was interested in generalizing the problem to any integral amount of Rupees ≥ 1 to start with.
For the first couple of integral Rupees we can easily figure out the maximum number of sweets that can be "bought" by hand and then seek the pattern. The first few ordered pairs (Rupees , Sweets) are:
( 1 , 1 ) , ( 2 , 2 ) , ( 3 , 4 ) , ( 4 , 5 ) , ( 5 , 7 ) , ( 6 , 8 ) , ( 7 , 1 0 ) , ( 8 , 1 1 ) , ( 9 , 1 3 ) , ( 1 0 , 1 4 )
The pattern is easily figured out and understood. The increase in the number of sweets is alternating 1 and 2 as the amount of Rupees steadily increases with 1.
If we only look at even Rupees amounts the sequence starts with 2 and increases with 1 + 2 = 3. As this series is a arithmetic sequence we therefore denote:
N = ⌊ 2 Rupees ⌋ with R = Rupees − 2 ⋅ N
This basically means that R is the remainder after division by 2.
Now the maximum number of sweets that can be bought with any integral amount of Rupees ≥ 1 is:
Sweets = 3 ⋅ ( N − 1 ) + 2 ⋅ ( R + 1 )
So if one spends 1729 Rupees on sweets then N = ⌊ 2 1 7 2 9 ⌋ = 8 6 4 , R = 1 7 2 9 − 2 ⋅ 8 6 4 = 1 and therefore the maximum number of sweets that can be "bought" is:
Sweets = 3 ⋅ ( 8 6 4 − 1 ) + 2 ⋅ ( 1 + 1 ) = 3 ⋅ 8 6 3 + 2 ⋅ 2 = 2 5 9 3
ooh..sir....thts really cool and new way.thank you
1729 Rs. = 1729 toffees
1729 toffees = 1729 wrappers = 576 toffees + 1 ex1 wrapper
576 toffees = 576 wrappers = 192 toffees
192 toffees = 192 wrappers = 64 toffees
64 toffees = 64 wrappers = 21 toffees + 1 ex2 wrapper
21 toffees = 21 wrappers = 7 toffees
7 toffees = 7 wrappers = 2 penultimate toffees + 1 ex3 wrapper
1 ex1 wrapper + 1 ex2 wrapper + 1 ex3 wrapper = 3 wrappers = 1 ex toffee
1 ex toffee + 2 penultimate toffees = 3 toffees
3 toffees = 3 wrappers = 1 last toffee
Total toffees (sum of all the toffees in bold):
1729 + 576 + 192 + 64 + 21 + 7 + 3 + 1 = 2593 toffees
Problem Loading...
Note Loading...
Set Loading...
To start with, the kid buy's 1 7 2 9 chocolates with R s . 1 7 2 9 . And hence he will now have 1 7 2 9 wrappers.
According to the question the kid can buy 1 more chocolate with every 3 wrappers, so he can now buy 3 1 7 2 9 chocolates.
But it leaves 1 as the remainder, so the kid can buy 5 7 6 chocolates.
Similarly, the remaining 5 7 6 wrappers, will get him 3 5 7 6 = 1 9 2 chocolates.
Moving on, he buys 6 4 chocolates, which will get him 3 6 4 = 2 1 chocolates, with a remainder of 1 wrapper.
Next, he can buy 7 2 1 = 7 chocolates with the 2 1 wrappers. Now, he uses the remaining 2 wrappers and gets 3 9 = 3 more chocolates.
At last, the Greedy Kiddo uses the last 3 wrappers to get 1 more chocolate.
So the maximum number of chocolates he can buy = 1 7 2 9 + 5 7 6 + 1 9 2 + 6 4 + 2 1 + 7 + 3 + 1 = 2 5 9 3
P.S: Please don't eat those many chocolates it can cause CAVITIES!