viewtopic.php?t=352122
So I wanted to give Mathematica a try as well.
I did execute "wolframscript" on 64bit Raspberry PiOS.
Factorization of integer works:
Code: Select all
In[1]:= FactorInteger[2^256-1]
Out[1]= {{3, 1}, {5, 1}, {17, 1}, {257, 1}, {641, 1}, {65537, 1}, {274177, 1},
> {6700417, 1}, {67280421310721, 1}, {59649589127497217, 1},
> {5704689200685129054721, 1}}
In[2]:=
Also factorization of gaussian integers works (complex numbers with real and imaginary part being integers).
Factorization of a prime p=1 (mod 4) results in determination of sum of squares, here 29=5^2 + 2^2:
Code: Select all
In[2]:= FactorInteger[29, GaussianIntegers->True]
Out[2]= {{-I, 1}, {2 + 5 I, 1}, {5 + 2 I, 1}}
In[3]:=
I used https://www.wolframalpha.com/ (Wolfram language in the browser) back in 2014 to provide generating formula for sequence A098586 on oeis.org (online encyclopedia of integer sequences), see "MATHEMATICA" section:
https://oeis.org/A098586
Just works as well:
Code: Select all
In[3]:= LinearRecurrence[{3, -1, -1}, {2, 5, 13}, 28]
Out[3]= {2, 5, 13, 32, 78, 189, 457, 1104, 2666, 6437, 15541, 37520, 90582, 218685,
> 527953, 1274592, 3077138, 7428869, 17934877, 43298624, 104532126, 252362877,
> 609257881, 1470878640, 3551015162, 8572908965, 20696833093, 49966575152}
In[4]:=
Yesterday I was very positively surprised of Pari's "factorint()" performance, it did factor 59 decimal digits number RSA-59 in 12 seconds on 1.8GHz Pi400!
Code: Select all
pi@pi400-64:~ $ time gp -q <(echo "print(factorint(71641520761751435455133616475667090434063332228247871795429));quit")
[200429218120815554269743635437, 1; 357440504101388365610785389017, 1]
real 0m12.048s
user 0m11.971s
sys 0m0.030s
pi@pi400-64:~ $
Now Mathematica does not take hours, but 13.5× the time of Pari:
Code: Select all
pi@pi400-64:~ $ time wolframscript -code "FactorInteger[71641520761751435455133616475667090434063332228247871795429]"
{{200429218120815554269743635437, 1}, {357440504101388365610785389017, 1}}
real 2m42.880s
user 0m1.478s
sys 0m1.959s
pi@pi400-64:~ $
Anyway, it is good to have access to Mathematica, although for interest in number theory I have there are killer arguments for Pari/GP as stated in the other posting:
https://oeis.org/wiki/PARI/GP#Comparison_to_other_CAS
In the domain of number theory, PARI/GP is a strong rival to well established all-purpose CAS as Maple and Mathematica, mainly due to its computational speed, where it typically outperforms both of these well known commercial CAS, and its free availability.
P.S:
I did measure factorization in wolframscript shell, took 2:28min, 14 seconds faster than above:
Code: Select all
pi@pi400-64:~ $ wolframscript
Wolfram Language 13.2.1 Engine for Linux ARM (64-bit)
Copyright 1988-2023 Wolfram Research, Inc.
In[1]:= FactorInteger[71641520761751435455133616475667090434063332228247871795429]
Out[1]= {{200429218120815554269743635437, 1}, {357440504101388365610785389017, 1}}
In[2]:=