Repunit primes: Difference between revisions

Content added Content deleted
(→‎J: add)
(→‎J: only a few seconds faster)
Line 307: Line 307:


=={{header|J}}==
=={{header|J}}==
Slow (runs several minutes).
Slow (runs for several minutes):
<syntaxhighlight lang="j">repunitp=. 1 p: <:@^ % <:@[
<syntaxhighlight lang="j">repunitp=. 1 p: ^ %&<: [


(2x + i. 15) (;/@[ ,. repunitp"0/ <@# ]) 2 + i. 999</syntaxhighlight>
(2x + i. 15) (;/@[ ,. repunitp"0/ <@# ]) i.&.(p:inv) 1000</syntaxhighlight>
{{out}}
{{out}}
<pre>
<pre>