mersenneforum.org  

Go Back   mersenneforum.org > Math Stuff > Computer Science & Computational Number Theory > PARI/GP

Reply
 
Thread Tools
Old 2010-11-27, 19:30   #1728
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26×131 Posts
Default

got it working:
Code:
test(n)=for(sqrN=sqrtint(n),n,sqrN2=sqrN^2;PCS=sqrtint(abs(sqrN2 - n));if(Mod(n,PCS+sqrN)!=0,,print(sqrN+PCS"*"sqrN-PCS);break()));

Last fiddled with by science_man_88 on 2010-11-27 at 19:30
science_man_88 is offline   Reply With Quote
Old 2010-11-27, 19:34   #1729
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

24·3·5·7 Posts
Default

Quote:
Originally Posted by science_man_88 View Post
got it working:
Code:
test(n)=for(sqrN=sqrtint(n),n,sqrN2=sqrN^2;PCS=sqrtint(abs(sqrN2 - n));if(Mod(n,PCS+sqrN)!=0,,print(sqrN+PCS"*"sqrN-PCS);break()));
It works, but trial division outspeeds it by a factor of 40.

Nevermind.. It gains the edge when it comes to a c18.

Last fiddled with by 3.14159 on 2010-11-27 at 19:36
3.14159 is offline   Reply With Quote
Old 2010-11-27, 19:36   #1730
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

20C016 Posts
Default

Quote:
Originally Posted by 3.14159 View Post
It works, but trial division outspeeds it by a factor of 40.

I knew these guys were lying kooks.
Yeah the largest Mersenne prime I felt like letting it finish was 2^19-1, anything over that I stopped at about 15 seconds in.

Last fiddled with by science_man_88 on 2010-11-27 at 19:37
science_man_88 is offline   Reply With Quote
Old 2010-11-27, 19:36   #1731
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

32208 Posts
Default

Also; For the rest of you out there;

I thought of this type of prime; k * (n! * p(n)#) + 1, or, if you'd like to generalize further, + b, where b is an integer.

There should be a k such that k * (n! * p(n)#) + 1 is composite with every n > 1.

I'll try looking for some that fit that description, to some extent.

Last fiddled with by 3.14159 on 2010-11-27 at 19:39
3.14159 is offline   Reply With Quote
Old 2010-11-27, 19:40   #1732
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26·131 Posts
Default

Quote:
Originally Posted by 3.14159 View Post
Also; For the rest of you out there;

I thought of this type of prime; k * (n! * p(n)#) + 1, or, if you'd like to generalize further, + b, where b is an integer.

There should be a k such that k * (n! * p(n)#) + 1 is composite with every n > 1.

I'll try looking for some that fit that description, to some extent.
p(n)# means what again ? I forgot.
science_man_88 is offline   Reply With Quote
Old 2010-11-27, 19:42   #1733
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

24·3·5·7 Posts
Default

Quote:
Originally Posted by science_man_88 View Post
p(n)# means what again ? I forgot.
p(n)#.

p(5)# = 2 * 3 * 5 * 7 * 11 = 2310.

Of course, the smallest prime of the type I mentioned is 3.

Last fiddled with by 3.14159 on 2010-11-27 at 19:43
3.14159 is offline   Reply With Quote
Old 2010-11-27, 19:44   #1734
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26×131 Posts
Default

Quote:
Originally Posted by 3.14159 View Post
p(n)#.

p(5)# = 2 * 3 * 5 * 7 * 11 = 2310.
so a primorial up to prime(n).
science_man_88 is offline   Reply With Quote
Old 2010-11-27, 19:53   #1735
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

110100100002 Posts
Default

Quote:
Originally Posted by science_man_88 View Post
so a primorial up to prime(n).
Yes. Product of the first n primes.

And; Patch this for me.

Code:
cs(a,x,m)=for(n=a,x,print(m*fp(n)+1));if(isprime(m*fp(n)+1),break)
Note that fp(n) = n! * p(n)#.

I got an error message;
Code:
***   gtos expected an integer, got 'n'.

Last fiddled with by 3.14159 on 2010-11-27 at 19:54
3.14159 is offline   Reply With Quote
Old 2010-11-27, 22:31   #1736
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

20C016 Posts
Default

Quote:
Originally Posted by 3.14159 View Post
Yes. Product of the first n primes.

And; Patch this for me.

Code:
cs(a,x,m)=for(n=a,x,print(m*fp(n)+1));if(isprime(m*fp(n)+1),break)
Note that fp(n) = n! * p(n)#.

I got an error message;
Code:
***   gtos expected an integer, got 'n'.
only thing I see wrong is p(n)# lol

never mind I fixed it embed the if and it worked for me lol.

Last fiddled with by science_man_88 on 2010-11-27 at 22:40
science_man_88 is offline   Reply With Quote
Old 2010-11-27, 23:30   #1737
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

24·3·5·7 Posts
Default

Quote:
Originally Posted by science_man_88 View Post
only thing I see wrong is p(n)# lol

never mind I fixed it embed the if and it worked for me lol.
.. Wait.. What revisions did you make to the code?

Also; Prime: 590 * (400! * p(400)#) + 1.

Last fiddled with by 3.14159 on 2010-11-27 at 23:35
3.14159 is offline   Reply With Quote
Old 2010-11-28, 00:05   #1738
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26·131 Posts
Default

Quote:
Originally Posted by 3.14159 View Post
.. Wait.. What revisions did you make to the code?

Also; Prime: 590 * (400! * p(400)#) + 1.
Code:
cs(a,x,m)=for(n=a,x,print(m*fp(n)+1);if(isprime(m*fp(n)+1),break(1)))
science_man_88 is offline   Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Why do I sometimes see all the <> formatting commands when I quote or edit? cheesehead Forum Feedback 3 2013-05-25 12:56
Passing commands to PARI on Windows James Heinrich Software 2 2012-05-13 19:19
Ubiquity commands Mini-Geek Aliquot Sequences 1 2009-09-22 19:33
64-bit Pari? CRGreathouse Software 2 2009-03-13 04:22
Are these commands correct? jasong Linux 2 2007-10-18 23:40

All times are UTC. The time now is 23:04.


Fri Aug 6 23:04:38 UTC 2021 up 14 days, 17:33, 1 user, load averages: 3.50, 3.80, 3.90

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, 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.