Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- GetCounts[k_, num_, b_] := Module[{ps, counts, units},
- ps = Mod[Prime /@ Range[num], b];
- Clear[counts];
- counts[n_] := 0;
- Do[
- counts[ps[[i ;; i + k - 1]]] = counts[ps[[i ;; i + k - 1]]] + 1;
- , {i, 1, num - k}];
- units = {1, 3, 7, 9};
- Table[counts[
- Reverse@Table[
- units[[1 + 2 Floor[2^-i Mod[m, 2^(i + 1)]] +
- Floor[2^-i Mod[n, 2^(i + 1)]]]]
- , {i, 0, k - 1}]]^0.8,
- {m, 0, 2^k - 1}, {n, 0, 2^k - 1}]
- ];
- PrimePlot[k_, num_] :=
- ArrayPlot[Transpose@GetCounts[k, num, 10],
- ColorFunction -> "Rainbow", Frame -> None];
- PrimePlot[8, 1000000]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement