Function isprime(n As Ulongint) As boolean If (n=2) Or (n=3) Then Return 1 If n Mod 2 = 0 Then Return 0 If n Mod 3 = 0 Then Return 0 Dim As Ulongint limit=Sqr(N)+1 For I As Ulongint = 6 To limit Step 6 If N Mod (i-1) = 0 Then Return 0 If N Mod (i+1) = 0 Then Return 0 Next I Return 1 End Function Sub getnonprimeables(a() As Long) Dim As String s,g Dim As Long count,lim=1300000 Redim a(1 To lim) For num As Long=1 To lim g=Str(num) s=g For n As Long=0 To Len(s)-1 For m As Long=48 To 57 s[n]=m If isprime(Vallng(s)) Then Goto lbl Next m s=g Next n count+=1 a(count)=num lbl: Next num Redim Preserve a(1 To count) End Sub Function endings(n As String,a() As Long) As Long For m As Long=1 To Ubound(a) If Right(Str(a(m)),1)=n Then Return a(m) Next m End Function Redim As Long n() getnonprimeables(n()) print " First 35" For m As Long=1 To 35 Print n(m); Next Print Print "600th number ";n(600) For z As Long=0 To 9 Print "first umprimable number ending in ";z; " is ";endings(Str(z),n()) Next z sleep