← Complete problem index

PROJECT EULER · #0977

Iterated Functions

Statement only · SolvedOriginal problem ↗

For a positive integer n, let F(n) denote the number of functions f from the set Sn={1,2,,n} to itself such that f(x)(y)=f(y)(x) for any x,y in Sn. Here f(k) denotes the k-th iterated composition of f, e.g. f(2)(x)=f(f(x)).

For example, F(3)=8, F(7)=174, F(100)=570271270297640131.

Find F(106)mod(109+7).

Write-up coming later

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