Is it possible to call the primesieve (Kim Walisch tool), from the pari/gp and pass the value in a variable in pari/gp? I would like to replace the primePi () function with this (as external function, maybe with system("f") command), because the premisieve is much faster to find prime numbers.
Asked
Active
Viewed 155 times
1 Answers
0
I haven't tried interfacing with primesieve, but you can definitely use the system
function to call external programs. The details will vary slightly depending on what operating system you have.
On Windows:
system(Str("echo ", 17, ">c:/work/temp.txt"))
will call the echo
command passing it a value of 17 and writing the output to a temporary file. (Note that I am using forward slash (/) in the path, rather than Windows normal backslash (\) because a backslash is also PARI's string escape character.
Then to read the result back into PARI:
read("c:/work/temp.txt")
seems to do the trick.

Andrew
- 873
- 4
- 10
-
You can also use `externstr`. – Charles Mar 27 '20 at 19:46