Блог пользователя knb

Автор knb, 12 лет назад, По-английски

I have a non linear recurrence relation a(n)=(n-1)*(a(n-1)+a(n-2)).How can I calculate a(n)%MOD in O(log(n)) time? Base conditions:-a(0)=0,a(1)=1

  • Проголосовать: нравится
  • +6
  • Проголосовать: не нравится

»
12 лет назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

This is basically a recurrence for n!. (The base conditions are not mentioned but even with those, the solution will not be very different). And I dont think there is a simple way to do it in sub-linear time. :(