// you’re reading...
1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 5.00 out of 5)
Loading...

Project Euler Solutions

Project Euler 116 Solution

Project Euler 116 Solution

Project Euler 116: Count the number of ways a space 50 units long could be filled by tiles, homogeneously, measuring 2, 3 or 4 units long.


Problem Description

A row of five black square tiles is to have a number of its tiles replaced with coloured oblong tiles chosen from red (length two), green (length three), or blue (length four).

If red tiles are chosen there are exactly seven ways this can be done.

pe116a

If green tiles are chosen there are three ways.

pe116b

And if blue tiles are chosen there are two ways.

pe116c

Assuming that colours cannot be mixed there are 7 + 3 + 2 = 12 ways of replacing the black tiles in a row measuring five units in length.

How many different ways can the black tiles in a row measuring fifty units in length be replaced if colours cannot be mixed and at least one coloured tile must be used?

NOTE: This is related to Problem 117.

Analysis

As a continuation from the two previous problems we remove the empty space option and one-space tile separation requirement. Now it makes sense to include a function since we are adding 3 different fixed-length tiles of sizes 2, 3 and 4.

Project Euler 116 Solution

Runs < 0.001 seconds in Python 2.7.
download arrowUse this link to get the Project Euler 116 Solution Python 2.7 source.

Answer

Slowly swipe from either end beginning with the white vertical bar to get an idea of the starting or ending digits. For less drama, just double click the answer area. The distance between the two bars will give you an idea of the magnitude. Touch devices can tap and hold the center of the box between the two bars and choose define to reveal the answer.
|20492570929|

Afterthoughts

Project Euler 116 Solution last updated

Discussion

No comments yet.

Post a comment