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

Prime counting function in Pari GP

The prime counting function pi(x) computes the number of primes less than x. With Pari being well oriented towards working with prime numbers, I thought this function would be implemented, but I did not find anything in the documentation. Is pi(x)…
Beni Bogosel
  • 572
  • 1
  • 6
  • 22
0
votes
1 answer

Dynamic array in GP/PARI

I need to calculate number of primes from 1 to N. For this i want to divide every next number n for primes in range 2 to sqrt(n). For this, in turn, i need to store all previously collected primes. How can i store them effectively? Just in case,…
Yola
  • 18,496
  • 11
  • 65
  • 106
0
votes
1 answer

Convert PARI program to C++

I found a sequence of interest in OEIS and I want to generate the same sequence in C++ for a programming competition solution I am working on. However I hit a roadblock understanding how the program given in the sequence page works. Here is the…
Sri Hari Vignesh
  • 256
  • 4
  • 11
0
votes
2 answers

PARI/GP: How to get the max prime factor of the integer?

I am new to pari/gp. I use factorint to find all the prime factors and it returns a matrix. I am trying to traverse through a matrix to find the largest number inside but unable to find the length of rows and columns. Also how can i use the if to…
Tommy Yap
  • 85
  • 1
  • 9
0
votes
2 answers

Checking if a returned number is an integer in GP/Pari?

This is my first time using GP/Pari and I am having trouble completing this question. I am asked to print if the return of the function 'wq()' is an integer. Is there a function that can determine if the number passed in is an integer? If not how…
0
votes
3 answers

How to check if a number is an integer in Pari/GP?

I'm trying to write an if statement like this if(denominator([(i-1)! + 1] / i)-1,print(hi),print(ho)) i can be any integer, for example 10. When I set i to 10 it gives this error: ? [(x-1)! + 1] / x *** this should be an integer: [(x-1)!+1]/x …
0
votes
1 answer

Adding lists of numbers in Pari/GP

I've got a .txt file, which contains a sequence of numbers as follows: a_1 +a_2 +a_3 +a_4 +a_5 ... Fix some positive integer n. Using Pari/GP, how can I write down the sequence [a_1, a_1 + a_2*n, a_1 + a_2*n + a_3*n, ...] as a Pari/GP vector?…
user5741674
0
votes
1 answer

How can I know if a number is inside a list in PARI/GP?

I am trying to know if a number is inside a PARI/GP list but I do not know how to do it, this is my code: mylist = listcreate(); ... here I add some numbers with listput(mylist,XXXX) /* How can I do the condition in the if... */ if(mynumber in…
iadvd
  • 179
  • 1
  • 2
  • 12
0
votes
2 answers

pari gp return function store in variable

I'm new to pari gp, and just trying out, playing with it. i have an inverse function that goes like this. inverse (a,n) = { negative = false; if (a < 0, negative = true); if (a < 0, a= a*-1); i = n; v = 0; d = 1; while (a>0,t=i/a;…
0
votes
1 answer

how can I convert an intmod to an int in pari/gp?

I am performing chinese remainder theorem with pari/GP, and the result is an intmod. Example: x = Mod(25, 33) x is an output of the Chinese remainder theorem. But I want to compare 24 and x. How can I extract the "25" from x to be able to…
0
votes
2 answers

PARI/GP and gcc

I am trying to install PARI/GP and in the configuration step I get: $ ./Configure [...] Looking for the compilers ... ...cc is /usr/bin/cc ...gcc is /usr/local/bin/gcc GNU compiler version 4.8.0 20120705 (experimental) (GCC) ### ### C compiler does…
emepyc
  • 949
  • 1
  • 10
  • 23
-1
votes
1 answer

how to sovle x^3 = a mod p ,where is p is prime, a is known. how to sovle it with PARI/GP/pg

when a solve x^3 = 11826493364627776165 mod 17178964373573894299 there are 3 solution [8385928023199723804,11846820199768219252,14125180524179845542] when i use PARI/GP i only get 1 solution as ?…
qinchao
  • 11
  • 1
-1
votes
1 answer

Carmichael Number using Pari

Trying to write Pari code to solve the above question.
HughM
  • 1
  • 6
1 2 3 4 5 6 7
8