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 to determine which numbers lie within a certain range

I currently have a list of numbers, and I want to know which of these numbers are within a certain range, and what their position is in the list. I'm reasonably new to pari so I'm not sure how exactly to go about this. For a simplistic example of…
Mystery_Jay
  • 161
  • 5
0
votes
1 answer

How to return the size of a set

I have a code in Pari gp that searches for pairs of (a(x),b(x)) for which a given value of x makes them prime. How can I return the total number of i that makes both a(x) and b(x) both prime a(x) =x power 8 + 1 b(x) = x power 10 + 1 for…
0
votes
1 answer

Problem Implementing a Recursive Parrallel For Loop Pari Version 2.11.1 Win64

I have a quadratic equation generating 2 solutions x1,x2 and each solution generates two new solutions again. This continues to infinity. The way I tried to implement this is using a routine with vector r=[x1,x2] as an input parameter. And use the…
0
votes
1 answer

Error in user defined functions with Gp/Pari

I'm trying to work on learning the Gp Pari programing language, and I'm working through project Euler problems and I can't seem to get it to compile right :( It's supposed to calculate a list of all Fibonacci numbers of size less than some input…
JonHales
  • 125
  • 6
0
votes
2 answers

SSP Algorithm minimal subset of length k

Suppose S is a set with t elements modulo n. There are indeed, 2^t subsets of any length. Illustrate a PARI/GP program which finds the smallest subset U (in terms of length) of distinct elements such that the sum of all elements in U is 0 modulo n.…
J. Linne
  • 275
  • 4
  • 15
0
votes
1 answer

DSA Signature Verification and BigInteger class

I have been given a (very) simple DSA problem, and have already found the key and other variables. To verify the signature I need to somehow translate the equation: V = [(y^u1*h^u2)mod p] mod q into a BigInteger operation. Is this even possible on…
0
votes
1 answer

How can I calculate this prime product faster with PARI/GP?

I want to calculate the product over 1-1/p , where p runs over the primes upto 10^10 I know the approximation exp(-gamma)/ln(10^10) , where gamma is the Euler-Mascheroni-constant and ln the natural logarithm, but I want to calculate the exact…
Peter
  • 214
  • 1
  • 10
0
votes
2 answers

Polynomials in Pari

I have some problems dealing with polynomials in Pari and finding the right commands in the documentation. is it possible to define Polynomials with multiple variables, e.g. f(x,y)=x^2+y^2-1 How can I evaluate a previously defined polynomial (by…
klirk
  • 127
  • 4
0
votes
2 answers

Pari/Gp directing output

Is there an easy convenient way to direct output in Pari/GP to file? My aim is to get the full decimal expansion of 2^400000-1 either on screen or in a text file? (23:37) gp > 2^400000-1 %947 = 996014342993......(4438 digits)......609762267975[+++]…
J. Linne
  • 275
  • 4
  • 15
0
votes
1 answer

How can I save multi variable results in a data structure using Pari?

I have a function that loops over its input and produces zero or more results, with each result consisting of three numbers. I want to keep those results in a data structure (e.g., a matrix or a vector of vectors) but I don't know how many entries…
Joe
  • 59
  • 6
0
votes
1 answer

How can I copy a large number from pari/gp into yafu to find factors?

Here : Copying numbers from PARI/GP I learnt how I can write a large number in PARI/GP and recover it. This works fine. But a new problem arises : I have a large number (13 653 digits) in a file and want to copy it in yafu in order to find factors.…
Peter
  • 214
  • 1
  • 10
0
votes
3 answers

Reading data from .txt file into Matlab

I have been trying in vain for days to do one seemingly simple thing--I want to read data from a .txt file that looks like this: 0.221351321 0.151351321 0.235165165 8.2254546 E-7 into Matlab. I've been able to load the data in the…
P. Gillich
  • 289
  • 1
  • 9
0
votes
1 answer

Mestre's sum with PARI/GP

I defined Mestre's sum as: S(E, N) = { my (s = 0.0); forprime(p = 2, N, my (a = ellap(E, p)); s += (2-a) / (p+1-a) ); return (s); } and defined polynomials A(t) and B(t) and I wanted to calculate above sum for…
user371596
  • 75
  • 3
0
votes
1 answer

Pair GP polynomial operator

There is trouble with PARI/GP. Does anyone know to operate the right function/command in PARI/GP, for fining the minimal polynomial of [y = x^2-x+1 (mod x^6+x^5+x^4+x^3+x^2+x+1)] PARI/GP gives this error: gp >…
J. Linne
  • 275
  • 4
  • 15
0
votes
1 answer

Pari GP - Checking if user keyed in a prime number

I am currently learning how to use Pari GP and right now i am trying to write out a code on checking whether if the user did key in a prime number or not. Here is my code. printf("\t%s \n","PrimeNo(P): To check if it is a prime or…
James Quek
  • 15
  • 3