Tag Info

New answers tagged

1

My implementation of mySquareFreeQ probably comes under the heading of "not what the teacher intended" :-) mySquareFreeQ = Thread[MoebiusMu@# != 0] & Timings: data = Binomial[2 #, #] &@Range[5, 30000]; Timing[Nor @@ SquareFreeQ /@ data] (* {0.140625, True} *) Timing[Nor @@ mySquareFreeQ @ data] (* {0.078125, True} *) So my implementation is ...


3

part (a) data = Table[n, {n, 5, 3000}]; Timing[ res = {#, SquareFreeQ[Binomial[2 #, #]]} & /@ data; Cases[res, {n_, True}] ] (* {0.280802, {}} *) part (b) data = Table[n, {n, 5, 3000}]; mySquareFreeQ[n_Integer] := TrueQ[Length[Cases[FactorInteger[n], {p_, m_} /; m > 1 :> True]] == 0]; Timing[ res ...



Top 50 recent answers are included