Factorial primes: Difference between revisions
m
→{{header|Python}}: Tidy
(→{{header|Ruby}}: Add Ruby) |
m (→{{header|Python}}: Tidy) |
||
Line 728:
{{libheader|gmpy2}}
<syntaxhighlight lang="python">
from itertools import count
from itertools import islice
from typing import Iterable
Line 739 ⟶ 740:
def factorials() -> Iterable[int]:
def factorial_primes() -> Iterable[Tuple[int, int, str]]:
for
if gmpy2.is_prime(
yield (
if gmpy2.is_prime(
yield (
def
print(f"First {
for
s = str(
if len(s) > 40:
s = f"{s[:20]}...{s[-20:]} ({len(s)} digits)"
print(f"{
if __name__ == "__main__":
import sys
</syntaxhighlight>
|