|
|
вернуться в форумПоказать все сообщения Спрятать все сообщенияsorry, bad english This sequence can be calculated as k1*((1+sqrt(5))/2)^n +k2*((1-sqrt(5))/2)^n By precalculation we can find such prime p, what: 1. p>4000000000; 2. exist such n, what n*n==5 (mod p) So, this sequence by modulo p can be calculated us k1*a^n + k2*b^n, where a,b,k1,k2 - integer It's all Edited by author 13.07.2009 11:09 Note that if you go this road, you are better using Java, since you will need modPow and modInverse. What about its complexity? |
|
|