Advertisement
Matthen

Consecutive Prime Digits

Mar 17th, 2016
940
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. GetCounts[k_, num_, b_] := Module[{ps, counts, units},
  2. ps = Mod[Prime /@ Range[num], b];
  3. Clear[counts];
  4. counts[n_] := 0;
  5. Do[
  6. counts[ps[[i ;; i + k - 1]]] = counts[ps[[i ;; i + k - 1]]] + 1;
  7. , {i, 1, num - k}];
  8. units = {1, 3, 7, 9};
  9. Table[counts[
  10. Reverse@Table[
  11. units[[1 + 2 Floor[2^-i Mod[m, 2^(i + 1)]] +
  12. Floor[2^-i Mod[n, 2^(i + 1)]]]]
  13. , {i, 0, k - 1}]]^0.8,
  14. {m, 0, 2^k - 1}, {n, 0, 2^k - 1}]
  15. ];
  16. PrimePlot[k_, num_] :=
  17. ArrayPlot[Transpose@GetCounts[k, num, 10],
  18. ColorFunction -> "Rainbow", Frame -> None];
  19. PrimePlot[8, 1000000]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement