← RoseCode

ROSECODE 511

Bell Numbers Modulo Factorial

Min_25 · Math ·

Let B(n) be the n-th Bell number, which can be computed as B(0)=1 and Bn+1=k=0n(nk)Bk for n0.

For example, B(5)=52 and B(10)=115975.

Let f(N,M):=B(N)modM.

You can verify that f(5,24)=4, f(10,8!)=35335 and f(104,12!)=82759235.

Find f(107,30!)mod(109+7).