SetDirectory["D:\\WORK\\Lectures\\Cours Master \
RADI\\TP-DFA\\curves\\curves"]

L = Table[0, {3536}];
Do[
L += 
        ReadList["SM_32_" <> GoodForm[ToString[j]] <> ".dat", 
          Number], 
{j, 1, 
        5000}
]

L = L/5000;

ListPlot[Take[L, 300], PlotJoined -> True]

GoodForm[s_] := 
        Module[{t = s}, 
          While[StringLength[t] ≠ 5, t = "0" <> t]; 
          t];
GoodForm["3"]

n = 
        115753540889062431344172474906327728114200335452658415236258067817852290090837;

PrimeQ@n

Sel[
          a_Integer] := IntegerDigits[a, 2, 256][[27]];

C0 = Table[0, {3536}];
C1 = Table[0, {3536}];
n0 = 0;
n1 = 0;

\(Do[
m = \(ReadList["msg_" <> 
              GoodForm[ToString[j]] <> ".dat", 
            Number]\)[\([1]\)]; 
If[
Sel[
            PowerMod[m, 4, n]] == 0, 
C0 += 
          ReadList["SM_32_" <> GoodForm[ToString[j]] <> ".dat", 
            Number]; 
\(n0++\)
, 
C1 += 
          ReadList["SM_32_" <> GoodForm[ToString[j]] <> ".dat", 
            Number]; 
\(n1++\)
]
, {j, 1, 5000}]\)

C0 = C0/n0;
C1 = C1/n1;

ListPlot[Take[C0, 300], PlotJoined -> True]

ListPlot[Take[C1 - C0, 300], PlotJoined -> True, 
      PlotRange -> All]

toto[r_] := N[r/2^((r - 1)/2)];

toto /@ {1, 2, 3, 4, 5, 6} // 
      ListPlot[#, PlotJoined -> True] &

H /@ {1, 2, 3}