A small VBA code to get these numbers:
- Sub Main()
- Dim i&, j&, k&, n&, num&, a(100000000) As Byte, p(1 To 10000000) As Long
- num = 1
- p(num) = 2 'The 1st prime
- n = 100000000 '10^8
- k = Int(Sqr(n)) 'sqrare root of n
- For i = 3 To k Step 2
- If a(i) = 0 Then
- num = num + 1
- p(num) = i
- If InStr(i, num) Then Debug.Print "P(" & num & ")=" & i
- For j = i * i To n Step 2 * i 'Eractosthenes
- a(j) = 100 'Not prime number
- Next
- End If
- Next
- For i = k + 1 To n Step 2 'List all prime numbers to array p()
- If a(i) = 0 Then
- num = num + 1
- 'p(num) = i
- If InStr(i, num) Then Debug.Print "P(" & num & ")=" & i
- End If
- Next
- End Sub
It returns:
P(7)=17
P(6455)=64553
P(6456)=64567
P(6457)=64577
P(6459)=64591
P(6460)=64601
P(6466)=64661
P(9551)=99551
P(303027)=4303027
P(440999)=6440999
P(968819)=14968819
P(5517973)=95517973