Factorial primes: Difference between revisions

added Arturo
(→‎OCaml: add)
(added Arturo)
Line 80:
10: 14! - 1 = 87178291199
</pre>
 
=={{header|Arturo}}==
<syntaxhighlight lang="arturo">found: 0
i: 1
 
while [found < 10][
fct: factorial i
 
if prime? dec fct [
found: found + 1
print [pad (to :string found) ++ ":" 4 (to :string i)++"! - 1 = " dec fct]
]
if prime? inc fct [
found: found + 1
print [pad (to :string found) ++ ":" 4 (to :string i)++"! + 1 = " inc fct]
]
i: i + 1
]</syntaxhighlight>
 
{{out}}
 
<pre> 1: 1! + 1 = 2
2: 2! + 1 = 3
3: 3! - 1 = 5
4: 3! + 1 = 7
5: 4! - 1 = 23
6: 6! - 1 = 719
7: 7! - 1 = 5039
8: 11! + 1 = 39916801
9: 12! - 1 = 479001599
10: 14! - 1 = 87178291199</pre>
 
=={{header|C++}}==
1,532

edits