← Complete problem index

PROJECT EULER · #0679

Freefarea

Statement only · SolvedOriginal problem ↗

Let S be the set consisting of the four letters {‘A’,‘E’,‘F’,‘R’}.
For n≥0, let S∗(n) denote the set of words of length n consisting of letters belonging to S.
We designate the words FREE,FARE,AREA,REEF as keywords.

Let f(n) be the number of words in S∗(n) that contains all four keywords exactly once.

This first happens for n=9, and indeed there is a unique 9 lettered word that contain each of the keywords once: FREEFAREA
So, f(9)=1.

You are also given that f(15)=72863.

Find f(30).

Write-up coming later

The complete problem is available here. An approach, code, and answer will be added later.