Function isPrime(Byval ValorEval As Uinteger) As Boolean If ValorEval < 2 Then Return False If ValorEval Mod 2 = 0 Then Return ValorEval = 2 If ValorEval Mod 3 = 0 Then Return ValorEval = 3 Dim d As Integer = 5 While d * d <= ValorEval If ValorEval Mod d = 0 Then Return False Else d += 2 If ValorEval Mod d = 0 Then Return False Else d += 4 Wend Return True End Function #define maxi 1000035 Dim As Integer CU = 0, C2 = 0, C3 = 0, C4 = 0, C5 = 0, N, I, P = 0 Dim As Integer Unsexy(10), Pairs(5), Trips(5), Quads(5), Quins(5) For N = maxi To 2 Step -1 If isPrime(N) Then P += 1 If Not isPrime(N-6) And Not isPrime(N+6) Then If CU < 10 Then Unsexy(CU) = N CU += 1 End If If isPrime(N-6) Then If C2 < 5 Then Pairs(C2) = N C2 += 1 If isPrime(N-12) Then If C3 < 5 Then Trips(C3) = N C3 += 1 If isPrime(N-18) Then If C4 < 5 Then Quads(C4) = N C4 += 1 If isPrime(N-24) Then If C5 < 5 Then Quins(C5) = N C5 += 1 End If End If End If End If End If Next N Print P; " primes less than"; maxi Print Chr(10); C2; " pairs ending with:" For I = 4 To 0 Step -1 Print " [" & Pairs(I)-6 & ", "& Pairs(I) & "]" Next I Print Chr(10); C3; " triplets ending with:" For I = 4 To 0 Step -1 Print " [" & Trips(I)-12 & ", "& Trips(I)-6 & ", "& Trips(I) & "]" Next I Print Chr(10); C4; " quadruplets ending with:" For I = 4 To 0 Step -1 Print " [" & Quads(I)-18 & ", "& Quads(I)-12 & ", "& Quads(I)-6 & ", "& Quads(I) & "]" Next I Print Chr(10); C5; " quintuplet(s) ending with:" I = Iif(C5 > 5, 5, C5) For I = I-1 To 0 Step -1 Print " [" & Quins(I)-24 & ", "& Quins(I)-18 & ", "& Quins(I)-12 & ", "& Quins(I)-6 & ", "& Quins(I) & "]" Next I Print Chr(10); CU; " unsexy primes ending with:" For I = 9 To 0 Step -1 Print Unsexy(I); ","; Next I Print Chr(8); " " Sleep