First time here? Check out the FAQ!

Ask Your Question
0

how to solve the errorOverflowError: cannot fit 'long' into an index-sized integer 122

asked 7 years ago

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

The following code of elliptic curve gives me above error.

p =2^31-1   # prime number
k.<a> = FiniteField (p^2) ; Finite Field in a of size 2147483647^2
R.<z> = k[];R#PolynomialRing(k);Univariate Polynomial Ring in z over Finite Field in a of size 2147483647^2

i have computed from my code B1

B1 =  858993459*a + 429496730

I want to compute

x= R(B_1*z+(B_1*z)^p);X

but it gives me above error how to solve it for large prime number.strong text

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
1

answered 7 years ago

dan_fulea gravatar image

The following works for me:

sage: p = 2^31 - 1
sage: p.is_prime()
True
sage: k.<a> = GF( p^2 )
sage: R.<z> = PolynomialRing( k, sparse=True )
sage: R
Sparse Univariate Polynomial Ring in z over Finite Field in a of size 2147483647^2
sage: B1 = 858993459*a + 429496730
sage: B1^p
1288490188*a + 1717986918
sage: B1*z + (B1*z)^p
(1288490188*a + 1717986918)*z^2147483647 + (858993459*a + 429496730)*z

The only important place is the one with PolynomialRing( k, sparse=True ), so that a sparse polynomial of high power can be stored.

Preview: (hide)
link

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 7 years ago

Seen: 2,047 times

Last updated: Sep 12 '17