Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #28 Nov 14 2014 11:21:13
%S 0,0,1,4,11,23,43,75,126,207,335,536,852,1350,2136,3378,5344,8462,
%T 13416,21300,33866,53923,85979,137274,219444,351203,562667,902327,
%U 1448298,2326472,3739820,6015701,9682260,15591825,25120251,40489004,65285631,105304917,169908475
%N Answer to Red, Green and Blue Tiles Problem.
%C A row of n black squares is to have a number of its squares replaced by rectangles of lengths 2 (red), 3 (green) or 4 (blue). In how many different ways can the original squares be replaced if rectangles cannot be mixed and at least one rectangle must be used?
%H Kristian Edlund, MathBlog, <a href="http://www.mathblog.dk/project-euler-116-coloured-tiles/">Project Euler 116: Investigating the number of ways of replacing square tiles with one of three coloured tiles.</a>
%H Project Euler, <a href="https://projecteuler.net/problem=116">Problem 116: Red, green or blue tiles</a>
%F Empirical g.f.: -x^2*(3*x^7+2*x^6+x^4-3*x^3-x+1) / ((x-1)^2*(x^2+x-1)*(x^3+x-1)*(x^4+x-1)). - _Colin Barker_, Nov 14 2014
%o (Python)
%o import math
%o for n in range(1, 40):
%o ans = 0
%o for k in range(0, n):
%o for i in range(2, 5):
%o for j in range(1, ((k/i)+1)):
%o c = k - (i * j) + j
%o ans = ans + (math.factorial(c) / (math.factorial(j) * math.factorial(k-(i*j))))
%o print ans
%K nonn
%O 0,4
%A _Jameson Lee_, Jul 02 2014