Repunit primes: Difference between revisions

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


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


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