## In a very simplified form, we can consider proteins as strings consisting of hydrophobic (H) and polar (P) elements, e.g. HHPPHHHPHHPH.

For this problem, the orientation of a protein is important; e.g. HPP is considered distinct from PPH. Thus, there are $2^n$ distinct proteins consisting of $n$ elements.

When one encounters these strings in nature, they are always folded in such a way that the number of H-H contact points is as large as possible, since this is energetically advantageous.

As a result, the H-elements tend to accumulate in the inner part, with the P-elements on the outside.

Natural proteins are folded in three dimensions of course, but we will only consider protein folding in two dimensions.

The figure below shows two possible ways that our example protein could be folded (H-H contact points are shown with red dots).

The folding on the left has only six H-H contact points, thus it would never occur naturally.

On the other hand, the folding on the right has nine H-H contact points, which is optimal for this string.

Assuming that H and P elements are equally likely to occur in any position along the string, the average number of H-H contact points in an optimal folding of a random protein string of length $8$ turns out to be $850 / 2^8 = 3.3203125$.

What is the average number of H-H contact points in an optimal folding of a random protein string of length $15$?

Give your answer using as many decimal places as necessary for an exact result.

### To solve this problem, we need to find the average number of H-H contact points in an optimal folding of a random protein string of length 15.

First, we can start by generating all possible protein strings of length 15. Since each element (H or P) has 2 possibilities, we will have a total of 2^15 (or 32768) protein strings.

Next, for each protein string, we need to find the optimal folding that maximizes the number of H-H contact points. This can be done by iterating through the string and counting the number of adjacent Hs. We can keep track of the maximum count encountered for each string.

Finally, we can sum up all the maximum counts for each protein string and divide it by the total number of protein strings to find the average.

Let’s write the Python code to solve this problem:

“`python

def calculate_average_hh_contact_points(length):

total_strings = 2**length

total_hh_contacts = 0

for i in range(total_strings):

protein_string = bin(i)[2:].zfill(length).replace(‘0’, ‘H’).replace(‘1’, ‘P’)

max_hh_contacts = 0

current_hh_contacts = 0

for j in range(1, length):

if protein_string[j] == ‘H’ and protein_string[j-1] == ‘H’:

current_hh_contacts += 1

else:

if current_hh_contacts > max_hh_contacts:

max_hh_contacts = current_hh_contacts

current_hh_contacts = 0

if current_hh_contacts > max_hh_contacts:

max_hh_contacts = current_hh_contacts

total_hh_contacts += max_hh_contacts

average_hh_contacts = total_hh_contacts / total_strings

return average_hh_contacts

# Calculate the average number of H-H contact points for a protein string of length 15

average_hh_contacts = calculate_average_hh_contact_points(15)

print(“Average H-H contact points for a protein string of length 15:”, average_hh_contacts)

“`

Running this code will give you the average number of H-H contact points for a protein string of length 15.

##### More Answers:

Zeckendorf RepresentationSelective Amnesia

Three Similar Triangles