25 lines
559 B
Plaintext
25 lines
559 B
Plaintext
;XIncludeFile "isprime.pb"
|
|
;XIncludeFile "factorial.pb"
|
|
|
|
If OpenConsole()
|
|
PrintN("First 10 factorial primes:")
|
|
Define found.i = 0, i,i = 1, fct.i
|
|
|
|
While found < 10
|
|
fct = factorial (i)
|
|
|
|
If isprime(fct-1)
|
|
found + 1
|
|
PrintN(RSet(Str(found),2) + ": " + RSet(Str(i),2) + "! - 1 = " + Str(fct-1))
|
|
EndIf
|
|
If isprime(fct+1)
|
|
found + 1
|
|
PrintN(RSet(Str(found),2) + ": " + RSet(Str(i),2) + "! + 1 = " + Str(fct+1))
|
|
EndIf
|
|
i + 1
|
|
Wend
|
|
|
|
PrintN(#CRLF$ + "--- terminado, pulsa RETURN---"): Input()
|
|
CloseConsole()
|
|
EndIf
|