a := 1:
for b to 25 do
a := a*ithprime(b):
end do:
a;
# now 'a' is the product of the primes less than 100.
composite_small := proc (n::integer)
description "procedure to determine if n has a prime factor less than 100";
if igcd(2305567963945518424753102147331756070, n) = 1 then return false
else return true;
end if;
end proc:
# so composite_small tests if there are any factors 2 through 97.
#begin initialization section
p := [0, 2, 6, 12, 14, 20, 24, 26, 30, 32];
o := [7517, 10247, 12137, 14447, 14867, 17177, 21377, 24107, 25997, 28727];
m := 30030;
#end initialization section
# implement isprime(m*n+o+p)
with(ArrayTools):
os:=Size(o, 2):
ps:=Size(p, 2):
#here ps is 10 so a prime constellation of length 10.
loopstop := 10^11:
loopstart := 0:
for n from loopstart to loopstop do
for a to os do
counter := 0; wc := 0; wd := 0;
while `and`(wd > -10, wd < ps) do
wd := wd+1;
if composite_small(m*n+o[a]+p[wd]) = false then wd := wd+1
else wd := -10 end if;
end do;
if wd >= 9 then
while `and`(counter >= 0, wc < ps) do
wc := wc+1;
if isprime(m*n+o[a]+p[wc]) then counter := counter+1;
else counter := -1
end if;
end do;
end if;
if counter = ps then print(m*n+o[a]) end if;
end do:
end do:
|