07-08-2023, 04:10 PM
Code: (Select All)
DefLng A-S
Dim p(20), k(250) As Integer
p(1) = 2: p(2) = 3: p(3) = 5: p(4) = 7: p(5) = 11: p(6) = 13: p(7) = 17: p(8) = 19: p(9) = 23: p(10) = 29
'yes these are primes
tt = Timer
Print "anti-prime, number of factors"
For i = 6 To 7000000 Step 2
iq = i
For j = 1 To 10
k(j) = 0
If p(j) > iq Then Exit For
If iq = 1 Then Exit For
Do Until (iq Mod p(j) <> 0)
k(j) = k(j) + 1: iq = iq \ p(j)
Loop
Next j
isum = 1
For jk = 1 To j
isum = (k(jk) + 1) * isum
Next jk
If isum > kmax Then
Print i, isum
kmax = isum
knum = knum + 1
End If
k = 0
Next i
Print Timer - tt
Print knum + 3 'missed 1,2,4