Recurrence relation and permutations -- restaurant items

41 Views Asked by At

There are three items at a fast food place, soda, burger, and fries. A soda costs \$2, a burger costs \$7 and fries cost \$4. Provide a recurrence relation and the initial conditions to the number of ways to order \$n worth of food. I want to see the recurrence relation and the initial conditions. Also, calculate the number of permutations to come up with \$30 worth of food.

Ive been struggling with this problem.

I just did a similar question and based it off of that.

Here is what I have come up with so far

For the initial condition's

$a_0 = 1, a_1 = 0, a_2 = 1 , a_3 = 0 , a_4 = 2 , a_5 = 0 , a_6 = 2 , a_7 = 1$

I got the initial conditions by looking at this website: https://oeis.org/search?q=1%2F%281-x%5E2%29%281-x%5E4%29%281-x%5E7%29&sort=&language=&go=Search

To find the nth term: $a_n = a_{n - 2} + a_{n - 4} + a_{n - 7}$

However I wrote a little recursive program to find up to the 20th term and these are the numbers it produced: $ 1, 0, 1, 0, 2, 0, 2, 1, 4, 2, 6, 5, 10, 9, 17, 18, 29, 33, 51, 61, 89 $

I think that it is wrong because I do not get 30 as an answer can someone provide me with some insight?

Any help will be much appreciated!

1

There are 1 best solutions below

0
On BEST ANSWER

You don't specify whether you distinguish orders according to the order in which items are ordered. In the initial values it seems that you don't distinguish by order, as $a_6=2$ seems to count $2+4$ and $4+2$ as the same order; but your recurrence relation is only correct if you do distinguish by order; e.g. it would yield $a_6=a_2+a_4=3$, counting $2+4$ and $4+2$ separately.