| 1 | initial version |
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.
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.