Aquatic opera

Some sharks, dolphins, and whales get in line to get tickets for the opera...

Since the sharks are an unruly bunch, they can't be in line before or after a dolphin:

How many ways do they have of forming a line consisting of ten sea creatures?


Inspiration: Brian Charlesworth

Image credit: https://www.pinterest.com http://www.istockphoto.com/ https://cliparts.zone


The answer is 8119.

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.

2 solutions

Geoff Pilling
Jul 12, 2017

A partial solution...

The answer is found using the following recursion relation:

Let N n N_n be the number of ways that n n sea creatures could form this line:

  • N 0 = 1 N_0 = 1
  • N 1 = 3 N_1 = 3
  • N n = 2 N n 1 + N n 2 N_{n} = 2N_{n-1} + N_{n-2} for n > 1 n>1

Using this relation,

N 10 = 8119 N_{10} = \boxed{8119}

To see how this recurrence relation is derived see Arthur's solution below...

Arthur Conmy
Jul 24, 2017

Let S n S_n , D n D_n and W n W_n denote the number of lines of length n n ending with a Shark, with a Dolphin and with a Whale respectively. In this notation, it is evident the answer we seek is S 10 + D 10 + W 10 S_{10}+D_{10}+W_{10} .

Now the three recurrence relations arise:

(1) S n + 1 = S n + W n S_{n+1}=S_n+W_n

(2) D n + 1 = D n + W n D_{n+1}=D_n+W_n

(3) W n + 1 = S n + D n + W n W_{n+1}=S_n+D_n+W_n

because, in words, while a whale can be 'put on the end' of any previous line, a shark cannot be put on the end of a whale line, and a whale cannot be put on the end of a shark line.

Now, it helps to also define Σ n = S n + D n + W n \Sigma_n=S_n+D_n+W_n , so we are looking for Σ 10 \Sigma_{10} . Adding together our recursion relations (1), (2) and (3):

S n + 1 + D n + 1 + W n + 1 = 2 S n + 2 D n + 3 W n S_{n+1}+D_{n+1}+W_{n+1}=2S_n+2D_n+3W_n

Σ n + 1 = 2 ( S n + D n + W n ) + W n \Sigma_{n+1}=2(S_n+D_n+W_n)+W_n

Σ n + 1 = 2 Σ n + W n \Sigma_{n+1}=2\Sigma_n+W_n

Since W n + 1 = S n + D n + W n = Σ n W_{n+1}=S_n+D_n+W_n=\Sigma_n , W n = Σ n 1 W_n=\Sigma_{n-1} so

Σ n + 1 = 2 Σ n + Σ n 1 \Sigma_{n+1}=2\Sigma_n+\Sigma_{n-1} , thus Geoff's recurrence relation is derived. It is left to find base cases Σ 1 = 3 \Sigma_1=3 and Σ 2 = 7 \Sigma_2=7 to work up to Σ 10 = 8119 \Sigma_{10}=\boxed{8119} , using artithmetic or a quick piece of code e.g

def sum(n):
    if n==1:
        return 3
    if n==2:
        return 7
    else:
        return 2*s(n-1) + s(n-2)

print(s(10))
...
>>>8119

Cool... I was trying to think of a good way to show it, and you hit the nail right on the head!

Geoff Pilling - 3 years, 10 months ago

Log in to reply

I hope the notation and explanations are clear. Thanks for the great problem!

Arthur Conmy - 3 years, 10 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...