document.write( "Question 1204818: A store is selling 7 types of hard candies: cherry, strawberry, orange, pineapple, apricot, blackberry, and lemon.
\n" ); document.write( "How many ways are there to choose:
\n" ); document.write( "(a) 17 candies?
\n" ); document.write( "Answer = \r
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "(b) 17 candies with at least a piece of each flavor?
\n" ); document.write( "Answer = \r
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "(c) 17 candies with at least 2 cherry and at least 3 lemon?
\n" ); document.write( "Answer =
\n" ); document.write( "
\n" ); document.write( "

Algebra.Com's Answer #841332 by ikleyn(52781)\"\" \"About 
You can put this solution on YOUR website!
.
\n" ); document.write( "A store is selling 7 types of hard candies: cherry, strawberry, orange, pineapple, apricot, blackberry, and lemon.
\n" ); document.write( "How many ways are there to choose:
\n" ); document.write( "(a) 17 candies?\r
\n" ); document.write( "\n" ); document.write( "(b) 17 candies with at least a piece of each flavor?\r
\n" ); document.write( "\n" ); document.write( "(c) 17 candies with at least 2 cherry and at least 3 lemon?
\n" ); document.write( "~~~~~~~~~~~~~~~~~~~~\r
\n" ); document.write( "
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "        In this my post,  I will solve parts  (a)  and  (b),  ONLY.\r
\n" ); document.write( "
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "
\r\n" );
document.write( "(a)  In this problem, there are 7 boxes in the store, marked cherry, strawberry, orange, pineapple, apricot, blackberry, and lemon.\r\n" );
document.write( "\r\n" );
document.write( "     We take each kind of candies from the respective box. In this part (a), it is allowed do not take candies from some boxes.\r\n" );
document.write( "\r\n" );
document.write( "     So, we take n= 17 candies from k= 7 boxes according to their names and allowing to skip some boxes.\r\n" );
document.write( "\r\n" );
document.write( "     We want to know in how many different ways it is possible to collect 17 candies doing this way.\r\n" );
document.write( "\r\n" );
document.write( "\r\n" );
document.write( "     Notice that we distinct the candies only by their names. The boxes are different, since they carry different names.\r\n" );
document.write( "\r\n" );
document.write( "     Different collections of 17 selected candies distinct only by the number of identical candies of each kind.\r\n" );
document.write( "\r\n" );
document.write( "\r\n" );
document.write( "     It is a typical problem for \"stars and bars\" methodology. There is a general formula for the number of distinct selections\r\n" );
document.write( "     of this kind\r\n" );
document.write( "\r\n" );
document.write( "\r\n" );
document.write( "                N = \"C%5Bn%2Bk-1%5D%5E%28k-1%29\" = \"C%5B17%2B7-1%5D%5E%287-1%29\" = \"C%5B23%5D%5E6\" = \"%2823%2A22%2A21%2A20%2A19%2A18%29%2F%286%2A5%2A4%2A3%2A2%2A1%29\" = 100947.\r\n" );
document.write( "\r\n" );
document.write( "\r\n" );
document.write( "     ANSWER.  The number of distinct ways to select 17 candies in this problem (part (a) ) is 100947.\r\n" );
document.write( "\r\n" );
document.write( "\r\n" );
document.write( "\r\n" );
document.write( "(b)  This problem is very similar to part (a), but there is one VERY important difference:\r\n" );
document.write( "\r\n" );
document.write( "\r\n" );
document.write( "              +-------------------------------------------------------------+\r\n" );
document.write( "              |    We MUST take at least one candy from each of 7 boxes;    |\r\n" );
document.write( "              |         it is NOT ALLOWED to skip any of boxes.             |\r\n" );
document.write( "              +-------------------------------------------------------------+\r\n" );
document.write( "\r\n" );
document.write( "\r\n" );
document.write( "     Again, it is a typical problem for \"stars and bars\" methodology, but of the different kind. \r\n" );
document.write( "     There is a general formula for the number of distinct selections of this specific kind\r\n" );
document.write( "\r\n" );
document.write( "\r\n" );
document.write( "                N = \"C%5Bn-1%5D%5E%28k-1%29\" = \"C%5B17-1%5D%5E%287-1%29\" = \"C%5B16%5D%5E6\" = \"%2816%2A15%2A14%2A13%2A12%2A11%29%2F%286%2A5%2A4%2A3%2A2%2A1%29\" = 8008.\r\n" );
document.write( "\r\n" );
document.write( "\r\n" );
document.write( "     ANSWER.  The number of distinct ways to select 17 candies in this problem (part (b) ) is 8008.\r\n" );
document.write( "
\r
\n" ); document.write( "\n" ); document.write( "Parts  (a)  and  (b)  are completed.\r
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "-------------------------\r
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "For the stars and bars method see this Wikipedia article\r
\n" ); document.write( "\n" ); document.write( "https://en.wikipedia.org/wiki/Stars_and_bars_%28combinatorics%29\r
\n" ); document.write( "
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "See also the lesson\r
\n" ); document.write( "\n" ); document.write( "    - Stars and bars method for Combinatorics problems \r
\n" ); document.write( "\n" ); document.write( "in this site.\r
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "Learn the subject from there.\r
\n" ); document.write( "
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "
\n" ); document.write( "
\n" );