Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,38 @@
|
|||
' version 18-01-2019
|
||||
' compile with: fbc -s console
|
||||
|
||||
Function isprime(number As ULongInt) As UInteger
|
||||
|
||||
If number Mod 2 = 0 Then Return 0
|
||||
If number Mod 3 = 0 Then Return 0
|
||||
Dim As UInteger i, max = Sqr(number)
|
||||
|
||||
For i = 5 To max Step 2
|
||||
If number Mod i = 0 Then Return 0
|
||||
Next
|
||||
|
||||
Return 1
|
||||
|
||||
End Function
|
||||
|
||||
' ------=< MAIN >=------
|
||||
|
||||
Dim As UInteger counter
|
||||
Dim As ULongInt i
|
||||
|
||||
Print : Print
|
||||
counter = 0
|
||||
For i = 42 To &HFFFFFFFFFFFFFFFF ' for next loop, loop maximum = 2^64-1
|
||||
If isprime(i) Then
|
||||
counter += 1
|
||||
Print Using "n =### ##################,"; counter; i
|
||||
If counter >= 42 Then Exit for
|
||||
i += i -1
|
||||
End If
|
||||
Next
|
||||
|
||||
' empty keyboard buffer
|
||||
While InKey <> "" : Wend
|
||||
Print : Print "hit any key to end program"
|
||||
Sleep
|
||||
End
|
||||
Loading…
Add table
Add a link
Reference in a new issue