Rember the google question {the first 10 digit prime in e}.com ?
Here is my vbscript answer which finds the first 10 digit prime in e
in half a second or so (depending upon your hardware).
Note, this code is built for speed rather than readability (or 'write
only code' as we call it here!).
s=Timer()
Dim a(100000)
r=Round(Sqr(100000))
For p=2 To r
While a(p)=True
p=p + 1
Wend
x=p * 2
While x<=100000
a(x)=True
x=x+p
Wend
Next
e="2718281828459045235360287471352662497757247093699959574966967627724076630353547594571382178525166427427466391932003059921817413596629043572900334295260595630738132328627943490763233829880753195251019011573834187930702154089149934884167509244761460668082264800168477411853742345442437107539077744992069551702761838606261331384583000752044933826560297606737113200709328709127443747047230696977209310141692836819025515108657463772111252389784425056953696770785449969967946864454905987931636889230098793"
For p=1 To Len(e)-9
c=Mid(e,p,10)
b=True
For x=2 To 100000
If a(x)=False Then
r=CDbl(c)/CDbl(x)
If r=Round(r) Then
b=False
Exit For
End If
End If
Next
If b=True Then
MsgBox c & " is the first 10 digit prime in e at p:" & p & vbCrLf &
"done in : " & Timer() - s & " seconds"
WScript.Quit
End If
Next