R:= [2, 3]: count:= 2:
for i from 4 to 500000 do
found:= false;
for j from 1 while R[j]^2 < i+1 do
if i mod R[j] = R[j]-1 and
ListTools:-BinarySearch(R, (i+1)/R[j]) <> 0 then
found:= true; break
fi
od;
if found then R:= [op(R), i]; count:= count+1;
fi
od:
f:= proc(n) local t, i, j, x, L;
x:= R[n]+1:
L:= R[1..n-1];
t:= 0:
for i from 1 while R[i]^2 < x do
if x mod R[i] = 0 and ListTools:-BinarySearch(L, x/R[i]) <> 0 then t:= t+1 fi
od;
t
end proc:
V:= Array(0..11):
for i from 1 to nops(R) do
v:= f(i);
if V[v] = 0 then V[v]:= R[i] fi;
od:
|