clear all; close all; clc;p = input('Introduceti numarul prim p= ');g = input('Introduceti numarul prim g= ');Nr=p-1;x=zeros(1, Nr);for i=1:Nr x(i)=mod(g^x(i-1), p);end; disp('Rezultatul este: '); disp(x);
MATLAB: See, i have this error in the code saying: ??? Attempted to access x(0); index must be a positive integer or logical. Error in ==> abc at 14 x(i)=mod(g^x(i-1), p);
duplicate post requiring mergingindexintegerlogical?positive
Best Answer