Primorial primes: Difference between revisions

Content added Content deleted
(→‎{{header|Raku}}: Add a Raku example)
(Add Factor)
Line 99: Line 99:
11: 11# + 1 = 200560490131
11: 11# + 1 = 200560490131
12: 13# - 1 = 304250263527209
12: 13# - 1 = 304250263527209
</pre>

=={{header|Factor}}==
{{works with|Factor|0.99 2022-04-03}}
<lang factor>USING: formatting kernel math math.factorials math.parser
math.primes sequences ;

: .p ( n i sgn p -- )
[ >dec "p" "#" surround ] 2dip
"%2d:%6s %s 1 = %d\n" printf ;

[let
1 0 :> ( i! p! )
[ i 12 <= ] [
p primorial 1 - :> a
a 2 + :> b
a prime? [ i p "-" a .p i 1 + i! ] when
b prime? [ i p "+" b .p i 1 + i! ] when
p 1 + p!
] while
]</lang>
{{out}}
<pre>
1: p0# + 1 = 2
2: p1# + 1 = 3
3: p2# - 1 = 5
4: p2# + 1 = 7
5: p3# - 1 = 29
6: p3# + 1 = 31
7: p4# + 1 = 211
8: p5# - 1 = 2309
9: p5# + 1 = 2311
10: p6# - 1 = 30029
11: p11# + 1 = 200560490131
12: p13# - 1 = 304250263527209
</pre>
</pre>