a[n_] := Module[{f}, f[1] = 1; f[2] = 3; f[i_] := f[i] = f[i - 1] + f[i - 2]; f[n]]mode[x_] := Module[{i}, i = 1; While[Mod[a[2*i], Prime[x]] != 2, i++;]; i]