RosettaCodeData/Task/Factorial-primes/FreeBASIC/factorial-primes.basic

20 lines
421 B
Plaintext

#include "isprime.bas"
#include "factorial.bas"
Print "First 10 factorial primes:"
Dim As Integer found = 0, i = 1
While found < 10
Dim As Integer fct = factorial (i)
If isprime(fct-1) Then
found += 1
Print Using "##: ##_! - 1 = &"; found; i; fct-1
End If
If isprime(fct+1) Then
found += 1
Print Using "##: ##_! + 1 = &"; found; i; fct+1
End If
i += 1
Wend
Sleep