Per my 'J is faster than J' post from a bit ago, pure-j implementation of
bigint ops can be faster than the builtins. To get parallelism, I suggest
working on many numbers at once, but only one limb of a given number at a
time. Miller-rabin is a popular, well-regarded primality test.
-E
On Tue, 25 Jan 2022, Raul Miller wrote:
http://www.rosettacode.org/wiki/Repunit_primes
Conceptually, this task might be tackled using an expression like
":@I. 1 p:(2+i.15) #."0 1/|.+./\.=i.1000
However, some of the numbers being tested for primality here are
rather large. Even the base 2 numbers reach 300 digits, and the base
16 numbers reach 1200 digits:
#":2x#.1000#1
302
#":16x#.1000#1
1203
So... how would we approach this in J?
Thanks,
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm