Solve problem: Among the first 50000 simple numbers find those that contain in their decimal representation the sequence 2015 (the smallest number with this property is 120157).
Prime[50000] M[n_] = 2 10^5 + 0 10^4 + 1 10^3 + 5 10^2 + n Do[If[PrimeQ[M[n]], Print[M[n]]], {n, 1, 99}] M[p_, q_] = p 10^5 + 2 10^4 + 0 10^3 + 1 10^2 + 6 10 + q Do[If[PrimeQ[M[p, q]], Print[M[p, q]]], {p, 1, 5}, {q, 1, 9}]