this function produces power modulo some number . It can be optimized to using
int power ( int n , int r , int q ) { int total = n ; for ( int i = 1 ; i < r ; i ++ ) total = ( total * n ) % q ; return total ; } string lucasTest ( int n ) {