## An enormous factorial

### Problem 288

Published on Saturday, 17th April 2010, 01:00 pm; Solved by 841; Difficulty rating: 30%
For any prime `p` the number N(`p`,`q`) is defined by
N(`p`,`q`) = ∑_{n=0 to q} T_{n}*`p`^{n}

with T_{n} generated by the following random number generator:

S_{0} = 290797

S_{n+1} = S_{n}^{2} mod 50515093

T_{n} = S_{n} mod `p`

Let Nfac(`p`,`q`) be the factorial of N(`p`,`q`).

Let NF(`p`,`q`) be the number of factors `p` in Nfac(`p`,`q`).

You are given that NF(3,10000) mod 3^{20}=624955285.

Find NF(61,10^{7}) mod 61^{10}