let @=3+sqrt(5)
so @^n = (3+sqrt(5))^n =(an+bn*sqrt(5))

@^(n-1)=(3+sqrt(5))*(an+bn*sqrt(5))

so an+1=3an+5bn
     bn+1=an+3bn
so [an bn]= A [an-1 bn -1]
               = A^n [a0 b0]   where a0=1 and b0=0
where a= [ 3   5,1   3]

calculate an and bn in each step and devide it by 1000 for next an and bn

at end step ans=(an + bn*sqrt(5)) mod 1000

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to