P658
projecteuler.net

Incomplete Words II

ℹ️Published on Saturday, 23rd February 2019, 01:00 pm; Solved by 265;
Difficulty rating: 55%

In the context of formal languages, any finite sequence of letters of a given alphabet Σ is called a word over Σ. We call a word incomplete if it does not contain every letter of Σ.

For example, using the alphabet Σ={a,b,c}, 'ab', 'abab' and '' (the empty word) are incomplete words over Σ, while 'abac' is a complete word over Σ.

Given an alphabet Σ of α letters, we define I(α,n) to be the number of incomplete words over Σ with a length not exceeding n.
For example, I(3,0)=1, I(3,2)=13 and I(3,4)=79.

Let S(k,n)=α=1kI(α,n).
For example, S(4,4)=406, S(8,8)=27902680 and S(10,100)983602076mod1000000007.

Find S(107,1012). Give your answer modulo 1000000007.



Soluzione

Last modified: May 16, 2025. Website built with Franklin.jl and the lovely Julia programming language.