Number of words

The function libsemigroups::number_of_words() can be used to compute the number of words over an alphabet with a given number of letters.

uint64_t libsemigroups::number_of_words(size_t n, size_t min, size_t max)

Returns the number of words over an alphabet with a given number of letters with length in a specified range.

Warning

If the number of words exceeds 2 ^ 64 - 1, then the return value of this function will not be correct.

Parameters
  • n – the number of letters in the alphabet

  • min – the minimum length of a word

  • max – the maximum length of a word

Throws

(None) – This function guarantees not to throw a LibsemigroupsException.

Returns

A value of type uint64_t.