Thanks for the Pari/GP function to use PFGW. That's handy.

Connecting to another thread on Lucas sequences, I saw the nice

OEISWiki page. Are there some good Pari/GP functions for lucasu(P,Q,n) and lucasv(P,Q,n) possibly with n = Mod(x,y)? Good in the sense of either (or both) (1) clean, (2) fast?

It looks like maybe polcoef could do it. Not sure about efficiently handling the modulo case though.

Pari/GP's fibonacci() is pretty basic. Does Mod(fibonacci(n),p) optimize? It seems unlikely.