Calculating Pisano periods for any integer

7.2k Views Asked by At

I recently stumbled across this SPOJ question:

http://www.spoj.com/problems/PISANO/ The question is simple. Calculate the Pisano period of a number. After I researched my way through the web, I found that a number's Pisano period can be calculated in terms of its prime factors. For prime numbers we have another method which uses Binet's formula. Is there any alternative for solving this problem?

1

There are 1 best solutions below

0
On

Let p be a prime number > 5. If p is 1 or 4 in the modulus of 5, then the Pisano period is a divisor of p-1. If p is 2 or 3 in the modulus of 5, then the Pisano period is a divisor of 2p+2.