Given a series as
f(n)=1^1 * 2^2 * 3^3 * ......n^n since n can be very large
Find the value of f(n)/f(r)*f(n-r)
and output it modulo m where m is any prime.
Now My approach is
f(n)=1^1%m * 2^2%m * 3^3%m ...... n^n%m
then find the value
(f(n)%m/f(r)%m * f(n-r)%m)%m
Is this modular arithematic will work for non-prime numbers also