Ask Your Question

Revision history [back]

Well, escaping the newlines works, but's it's ugly:

%gp
lucas(p) ={\
my(u,q); \
u=4;\
q=1<<p - 1;\
for(k=3,p, u = (sqr(u)-2) % q);\
u == 0;\
}
lucas(5)

I think this might be a bug (or undocumented feature) in the GP interface.