J=input('Value of J: ');L=input('Value of L: ');for j = L:6; for i = 2:j-1; for a=0:J-1; for b=a+1:J-1; for c = 0:L-1; for d = c+1:L-1; if mod(((i^b-i^a)*(i^d-i^c)),j)~=0 p_q=[i,j] end end end end end endend
output:
p_q = 2 3
p_q = 2 3
p_q = 2 4
p_q = 2 4
p_q = 2 4
p_q = 2 5
p_q = 2 5
p_q = 2 5
p_q = 3 5
p_q = 3 5
p_q = 3 5
p_q = 4 5
p_q = 4 5
p_q = 2 6
and so on.
Here the required answer is p=2 and q=5; it is the only combination for which mod(((i^b-i^a)*(i^d-i^c)),j)~=0 for any values of a,b,c,d. But here it is showing so many answers. Kindly help me.
Best Answer