Generate text with n subsequences

92 Views Asked by At

For given natural number $n$ generate not so long text made of not so big number of signs, which has exactly $n$ different sub-sequences. But remember that empty sub-sequence is also the sub-sequence. We consider sub-sequences to be different if their text is different. For instance sequence “ioi” has seven sub-sequences (i,o,ii,io,oii,ioi and empty sub-sequence).

Is there any math formula or algorithm to solve it? I'm trying to solve it for almost one day and I still have no idea for solution