Message Boards Message Boards

0
|
4148 Views
|
3 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Find primes that contain in their decimal representation the sequence 2015?

Posted 8 years ago

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).

POSTED BY: Tereza Lion
3 Replies

I think you mean with simple numbers prime numbers? I guess so, because my result shows 120157 as the first:

FromDigits /@ Cases[IntegerDigits[Prime[Range[50000]]], {___, 2, 0, 1, 5, ___}]

giving:

{120157, 201511, 201517, 201547, 201557, 201577, 201581, 201589, 201599, 220151, 320153, 520151}

Next time, please show your own code, and what you have tried as per the community guidelines!

POSTED BY: Sander Huisman
Posted 8 years ago
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}]
POSTED BY: Tereza Lion
Posted 8 years ago

thanks!!!!!!!

POSTED BY: Tereza Lion
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract