Question: Produce a list of primes for which both 2 and 3 generate the prime field

The Question: 

'Produce a list of the primes p between 2000 and 3000 for which both 2 and 3 generate Fpx ' 

I have my code for producing the list of primes between 2000 and 3000:

p:=nextprime(2000):
primes:=[]:
while p<=3000 do
  primes:=[primes[],p];
  p:=nextprime(p);
end do:
 

I also have  code for finding the order of a number in Fpx


findOrderOf:=proc(g,p)
 local gpwr, i;
  gpwr:=1:
for i from 1 to p-1 do
  gpwr:=gpwr*g mod p; 
if (gpwr = 1) then:
return i;
end if:
end do:
end proc:
 

 

but I don't know how to relate them or how to create the overall code - any advice would be very helpful!!
 

Please Wait...