Data update
This commit is contained in:
parent
35bcdeebf8
commit
74c69a0df6
2427 changed files with 31826 additions and 3468 deletions
24
Task/Factorial-primes/PureBasic/factorial-primes.basic
Normal file
24
Task/Factorial-primes/PureBasic/factorial-primes.basic
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
;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
|
||||
Loading…
Add table
Add a link
Reference in a new issue