In the language of wolves has two letters $F$ and $P$, any finite sequence which forms a word. А word $Y$ is called 'subpart' of word $X$ if Y is obtained from X by deleting some letters (for example, the word $FFPF$ has 8 'subpart's: F, P, FF, FP, PF, FFP, FPF, FFF). Determine $n$ such that the $n$ is the greatest number of 'subpart's can have n-letter word language of wolves. F. Petrov, V. Volkov
Problem
Source:
Tags: combinatorics proposed, combinatorics
18.04.2014 15:47
There must be something missing. The maximum number of subparts over the $n$-letter words is quite larger than $n$.
13.10.2017 17:10
Right question is: In the language of wolves has two letters $F$ and $P$, any finite sequence which forms a word. А word $Y$ is called 'subpart' of word $X$ if Y is obtained from X by deleting some letters (for example, the word $FFPF$ has 8 'subpart's: $F, P, FF, FP, PF, FFP, FPF, FFF$). For given $n$ find the greatest number of 'subpart's can have $n$-letter word language of wolves.
20.01.2022 12:51
(subpart of a word - потомок from russian statement) Before finding maximum, let's find some recursive relations that comes up when creating n-letter word from [n-1] - letter word. Suppose [n-1] - letter word had a[n-1] different subparts ending at F, and b[n-1] different subparts ending at P. Total number of subparts is a[n-1]+b[n-1]. Then if we add F as nth letter, we will get a[n] = a[n-1] + b[n-1] + 1 (number of subparts ending at F is a[n]), and b[n] = b[n-1]. (proof below (*)) So from (a[n-1], b[n-1]) pair we can go to either (a[n-1] + b[n-1] + 1, b[n-1]) or (a[n-1] + b[n-1] + 1, a[n-1]) depending on whether we add F or P. Notice that if a[n-1] is larger than b[n-1] we better go with the second pair since it is stricly larger on each coordinate thus at the end will give us larger result a[n] + b[n] (for any sequence of additions performed on pair 1, we can perform similar sequence achieving higher a[n] + b[n]). So now we know how to create n-letter word with maximal a[n] + b[n]. We start at pair (0, 0) (for 0-letter word), then our sequence is (1,0) (1, 2) (4, 2) (4, 7) (12, 7) (12, 20) (33, 20). We can easily notice and prove (F[n] - 1, F[n-1] -1) formula where F is fibonacci numbers. With sum being F[n] + F[n-1] - 2 = F[n+1] - 2. So answer for n-letter word will be F[n+1] - 2 is maximum number of subparts (F[0] = 0, F[1] = 1). (*) proof. a[n] = a[n-1] + b[n-1] + 1. Consider your supbart ending at F, we have 3 cases if the letter before the last F is P, F or nothing: .....PF, ....FF, _F each case having no more than b[n-1], a[n-1], 1 occurrences respectively, because removing last F, we will get supbart from [n-1]-letter, and each such subpart is counted in b[n-1], a[n-1] values. Notice that we can achieve exactly b[n-1], a[n-1], 1 different occurences, just by appending to b[n-1] subparts ending at P the letter F, and to a[n-1] subparts ending at F the letter F. New subpart will still be different since removing last F, will lead back to different subparts again. And 1 comes from just the single letter F.