mersenneforum.org  

Go Back   mersenneforum.org > Great Internet Mersenne Prime Search > Software

Reply
 
Thread Tools
Old 2018-06-27, 04:46   #1
devarajkandadai
 
devarajkandadai's Avatar
 
May 2004

4748 Posts
Default pari and p-adic numbers

On page 19 of " number theory" by Borevich and Shefarevich you will find a sequence that leads to 7-adic numbers. The sequence depends on the solution of a linear equation at every stage. An alternate method using pari is illustrated below:

10 = = 3 (mod 7)
108== 10(mod 7^2)
451 = = 108 (mod 7^3)
we now use code: {is(n) = Mod((108 + 343*n),7^4)^2 = = 2};
select (is,[1..100]). we get a sequence of numbers satisfying the code. The smallest
value of n obtained is 6 leading to the next member of above sequence: 2166.
Thus we have obtained a sequence ( using pari) without having to solve any linear
equation.This can be continued indefinitely.
devarajkandadai is offline   Reply With Quote
Old 2018-06-27, 04:56   #2
VBCurtis
 
VBCurtis's Avatar
 
"Curtis"
Feb 2005
Riverside, CA

10DF16 Posts
Default

Why did you use 108 rather than 59 in the second congruence?
VBCurtis is offline   Reply With Quote
Old 2018-06-27, 12:29   #3
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

10111001000112 Posts
Default

Quote:
Originally Posted by devarajkandadai View Post
On page 19 of " number theory" by Borevich and Shefarevich you will find a sequence that leads to 7-adic numbers. The sequence depends on the solution of a linear equation at every stage. An alternate method using pari is illustrated below:

10 = = 3 (mod 7)
108== 10(mod 7^2)
451 = = 108 (mod 7^3)
we now use code: {is(n) = Mod((108 + 343*n),7^4)^2 = = 2};
select (is,[1..100]). we get a sequence of numbers satisfying the code. The smallest
value of n obtained is 6 leading to the next member of above sequence: 2166.
Thus we have obtained a sequence ( using pari) without having to solve any linear
equation.This can be continued indefinitely.
So instead of solving a linear equation, you had gp solve 100 linear equations.
CRGreathouse is offline   Reply With Quote
Old 2018-06-27, 14:04   #4
Dr Sardonicus
 
Dr Sardonicus's Avatar
 
Feb 2017
Nowhere

22·3·172 Posts
Default

Quote:
Originally Posted by CRGreathouse View Post
So instead of solving a linear equation, you had gp solve 100 linear equations.
Why not use polhensellift() or factorpadic()?
Dr Sardonicus is offline   Reply With Quote
Old 2018-06-27, 14:25   #5
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

5,923 Posts
Default

Quote:
Originally Posted by Dr Sardonicus View Post
Why not use polhensellift() or factorpadic()?
The GP code in A034945 just uses the built-in p-adic type. It takes 9 milliseconds to find the 100,000-th term on my machine. devaraj, feel free to compare to your code, I'm not sure how to extend it to that case. As a quick check my answer has 84,510 decimal digits and is of the form
Code:
259265345916500277712186481134963754311965201010586807205594069157787134361146417423434312945701993552539489...9746222274903009641714981399405417166669775352016495125084837567091444060752850366048748957882425104
where the ... represents about 84,300 digits.

In fairness, it errors out if I ask for the millionth term:
Code:
> a(10^6)
  *** _+_: Warning: increasing stack size to 40000000.
  *** _+_: Warning: increasing stack size to 80000000.
  ***   at top-level: a(10^6)
  ***                 ^-------
  ***   in function a: truncate(sqrt(2+O(7^n)))
  ***                                 ^---------
  *** _+_: overflow in precp().
  ***   Break loop: type 'break' to go back to GP prompt
So maybe you can improve on this!

Last fiddled with by CRGreathouse on 2018-06-27 at 14:51
CRGreathouse is offline   Reply With Quote
Old 2018-06-28, 03:03   #6
devarajkandadai
 
devarajkandadai's Avatar
 
May 2004

22·79 Posts
Default

Quote:
Originally Posted by VBCurtis View Post
Why did you use 108 rather than 59 in the second congruence?
Because 59^2 not congruent to 2 (mod 7^3)
devarajkandadai is offline   Reply With Quote
Old 2018-06-28, 10:51   #7
devarajkandadai
 
devarajkandadai's Avatar
 
May 2004

13C16 Posts
Default

Quote:
Originally Posted by CRGreathouse View Post
So instead of solving a linear equation, you had gp solve 100 linear equations.
I cannot pretend to be a good pari code writer; even the little knowledge i picked up from you.
devarajkandadai is offline   Reply With Quote
Old 2018-06-28, 11:21   #8
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26×131 Posts
Default

Quote:
Originally Posted by devarajkandadai View Post
I cannot pretend to be a good pari code writer; even the little knowledge i picked up from you.
solve() may come in handy. In my PARI there's also padicfields, padicappr, and padicprec.
science_man_88 is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
pari- p-adic numbers devarajkandadai Software 0 2017-09-23 04:31
LLL in GP/Pari paul0 Programming 2 2015-11-17 13:04
PARI vs GAP skan Miscellaneous Math 0 2012-12-16 00:13
pari devarajkandadai Programming 21 2012-08-31 18:08
64-bit Pari? CRGreathouse Software 2 2009-03-13 04:22

All times are UTC. The time now is 14:45.

Thu Sep 24 14:45:00 UTC 2020 up 14 days, 11:55, 1 user, load averages: 1.30, 1.54, 1.63

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.