Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,51 @@
Function isPrime(n As Ulongint) As Boolean
If n < 2 Then Return False
If n Mod 2 = 0 Then Return false
For i As Uinteger = 3 To Int(Sqr(n))+1 Step 2
If n Mod i = 0 Then Return false
Next i
Return true
End Function
Dim Shared As Uinteger n(1)
Dim Shared As Uinteger i0 = 0, i1 = 1
Dim Shared As Integer j, c, P = 1, Q = -2
Print "First 30 Jacobsthal numbers:"
c = 0 : n(i0) = 0: n(i1) = 1
For j = 0 To 29
c += 1
Print Using " #########"; n(i0);
Print Iif (c Mod 5, "", !"\n");
n(i0) = P * n(i1) - Q * n(i0)
Swap i0, i1
Next j
Print !"\n\nFirst 30 Jacobsthal-Lucas numbers: "
c = 0 : n(i0) = 2: n(i1) = 1
For j = 0 To 29
c += 1
Print Using " #########"; n(i0);
Print Iif (c Mod 5, "", !"\n");
n(i0) = P * n(i1) - Q * n(i0)
Swap i0, i1
Next j
Print !"\n\nFirst 20 Jacobsthal oblong numbers: "
c = 0 : n(i0) = 0: n(i1) = 1
For j = 0 To 19
c += 1
Print Using " ###########"; n(i0)*n(i1);
Print Iif (c Mod 5, "", !"\n");
n(i0) = P * n(i1) - Q * n(i0)
Swap i0, i1
Next j
Print !"\n\nFirst 10 Jacobsthal primes: "
c = 0 : n(i0) = 0: n(i1) = 1
Do
If isPrime(n(i0)) Then c += 1 : Print n(i0)
n(i0) = P * n(i1) - Q * n(i0)
Swap i0, i1
Loop Until c = 10
Sleep