|
PROGRAM
|
(PARI) jackbuilt(n, a, b, c) =
{
local(x, y, y1);
x=sqrt(a)+sqrt(b);
y=(x^n+1/x^n)/sqrt(a)+ c;
y1=eval(mid(Str(y), 1, instr(Str(y), ".")-1));
}
jackbuilt2(m, n, a, b, c) =
{ local(j, y);
forstep(j=m, n, 2,
y=jackbuilt(j, a, b, c);
if(ispseudoprime(y), print(j", "y))
)
}
mid(str, s, n) = /* Get a substring of length n from string str starting at
position s in str. */
{
local(v, x, tmp);
v ="";
tmp = Vec(str);
for(x=s, s+n-1,
v=concat(v, tmp[x]);
);
return(v)
}
instr(str, match) = /*Get the position of occurrence of match in string str.*/
{
local(lns, lnm, x);
str=Str(str); /* This allows leaving quotes off input*/
match=Str(match);
lnm=length(match);
lns=length(str);
for(x=1, lns-lnm+1,
if(mid(str, x, lnm)==match, return(x))
)
}
|