Questions tagged [pari]

a C library targeted at number theorists and mathematicians allowing fast number-theoretic computations (factorizations, algebraic number theory, elliptic curves...), also including routines for computing with matrices, polynomials, power series, algebraic numbers etc.

This tag is for the C-library PARI. See for the scripting language GP and associated computer algebra system PARI/GP. Questions with this tag should generally also have the tag.

118 questions
0
votes
1 answer

How can I create and save a file under PARI/GP?

This is the first time I'm working with PARI/GP under Windows. I have to create a file and save it to write my code. I tried the \r and \w and didn't work. I couldn't also find much documentation. How could I do it?
abby
  • 9
  • 2
0
votes
2 answers

How to print libpari version in c?

I would like to print version of libpari library from c program #include #include #include #include int main(void){ gmp_printf ("MPFR library: %-12s\nMPFR header: %s (based on %d.%d.%d)\n", …
Adam
  • 1,254
  • 12
  • 25
0
votes
3 answers

How do you get bit_length() in PARI/GP

I've looked on google and couldn't find the answer and thought i'd ask PARI/GP users here. My question is simply How do you get bit_length() in PARI/GP, that you can use at there interpreter here: https://pari.math.u-bordeaux.fr/gp.html
oppressionslayer
  • 6,942
  • 2
  • 7
  • 24
0
votes
1 answer

Is it possible to parallelize python code using Pari via cypari2?

I'm having trouble trying run a few loops in parallel when employing Pari via cypari2. I'll including a couple of small working examples along with the Tracebacks in case anyone has some insight on this. Example 1 -- using joblib: from cypari2…
0
votes
1 answer

What is the meaning of mod in quadray of Pari software

I need a polynomial that defines the narrow Hilbert class field of the real quadratic field x^2-505. How quadray could do this? quadray(x^2-505,-1)? What is the meaning of Mod in output? x^4 + Mod(-19*y - 207, y^2 - y - 126)*x^3 + Mod(305*y + 3277,…
0
votes
1 answer

RSA and convergents

I'm trying to do a function in PARI that computes a^(c*q_t) mod n; where c and n are such big numbers, and q_t is the denominator of a convergent of n/c. This is for RSA purposes. I'd just like to improve this function, so that computer would do it…
Anonymous
  • 49
  • 1
  • 9
0
votes
2 answers

Constructing Taylor Series from a Recursive function in Pari-GP

This is a continuation of my questions: Declaring a functional recursive sequence in Matlab Is there a more efficient way of nesting logarithms? Nesting a specific recursion in Pari-GP But I'll keep this question self contained. I have made a coding…
Richard Diagram
  • 209
  • 1
  • 7
0
votes
1 answer

Stack Overflow when using gp2c but not when using gp directly with the same program (PARI/GP)

So I wanted to calculate a sum from a particular projecteuler question using gp. Here's the, admittedly unreadable, code: { n = 10000; m=100; sum(k=1,n,eulerphi(k),0.) - (sum(k=1,n,eulerphi(k)*(k * binomial(n-k,m-1) + sum(p = max(m + k - n - 1,1),…
Oussema
  • 103
  • 3
0
votes
2 answers

Most common term in a vector - PARI/GP

I feel like I'm being really stupid here as I would have thought there's a simple command already in Pari, or it should be a simple thing to write up, but I simply cannot figure this out. Given a vector, say V, which will have duplicate entries, how…
Mystery_Jay
  • 161
  • 5
0
votes
0 answers

Counting bigrams

I do already have a function that counts the number of times that a letter occurs in a text. Now I am trying to do it for bigrams. Until now, I have CountDi(txt, L1, L2)={ local(ct,len,v); ct=0;len=#txt; v=Vecsmall(txt); for(k=1,len, if(v[k]…
Anonymous
  • 49
  • 1
  • 9
0
votes
1 answer

pointer optional argument in pari gp functions programming

look at this example please f(a,{e})={ispower(a,3,&e)} i did that to store the result in e but when I in call the function as f(27,t) the program don't store the "3" in t any help
Don Freecs
  • 133
  • 3
0
votes
1 answer

How can we find out if some number is of the form f(x) in pari?

I use pari very much for my mathematical research. But I couldn't figure out how to find out if a number can be represented as f(x) for some number x and function f. For example, Euler's totient function φ(x) is defined as the number of natural…
user14697742
0
votes
1 answer

How to use OpenMP with PARI/GP?

I want to parallelize a for loop that includes some operations from PARI/GP library, along with some other operations. However, using OpenMP with PARI/GP does not seem very straightforward it appears. The only similar example I found is this, which…
terett
  • 355
  • 1
  • 8
0
votes
2 answers

Convert a p-adic number to a vector in Pari/GP

I want to extract the elements of a Pari/GP p-adic number to a vector. I.e., if this is my p-adic number: O(5^8)+1/3 > 2 + 3*5 + 5^2 + 3*5^3 + 5^4 + 3*5^5 + 5^6 + 3*5^7 + O(5^8) I want to be able to extract a vector like this: [2,3,1,3,1,3,1,3] Is…
Joe Slater
  • 115
  • 3
0
votes
1 answer

How to modify a Pari code to test a conjecture

liste(lim,mul,base=34,step=5590,offset=588)=my(v=List(),X=mul*base); lim\=1; while(X