mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   PARI/GP (https://www.mersenneforum.org/forumdisplay.php?f=155)
-   -   PARI's commands (https://www.mersenneforum.org/showthread.php?t=13636)

science_man_88 2010-11-27 19:30

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()));[/CODE]

3.14159 2010-11-27 19:34

[QUOTE=science_man_88;238936]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()));[/CODE][/QUOTE]

It works, but trial division outspeeds it by a factor of 40.

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

science_man_88 2010-11-27 19:36

[QUOTE=3.14159;238937]It works, but trial division outspeeds it by a factor of 40.

I knew these guys were lying kooks.[/QUOTE]

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.

3.14159 2010-11-27 19:36

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.

science_man_88 2010-11-27 19:40

[QUOTE=3.14159;238939]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.[/QUOTE]

p(n)# means what again ? I forgot.

3.14159 2010-11-27 19:42

[QUOTE=science_man_88;238940]p(n)# means what again ? I forgot.[/QUOTE]

p(n)#.

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

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

science_man_88 2010-11-27 19:44

[QUOTE=3.14159;238941]p(n)#.

p(5)# = 2 * 3 * 5 * 7 * 11 = 2310.[/QUOTE]

so a primorial up to prime(n).

3.14159 2010-11-27 19:53

[QUOTE=science_man_88;238943]so a primorial up to prime(n).[/QUOTE]

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)[/CODE]

Note that fp(n) = n! * p(n)#.

I got an error message; [CODE]*** gtos expected an integer, got 'n'.[/CODE]

science_man_88 2010-11-27 22:31

[QUOTE=3.14159;238944]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)[/CODE]

Note that fp(n) = n! * p(n)#.

I got an error message; [CODE]*** gtos expected an integer, got 'n'.[/CODE][/QUOTE]

only thing I see wrong is p(n)[COLOR="Red"]#[/COLOR] lol

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

3.14159 2010-11-27 23:30

[QUOTE=science_man_88;238959]only thing I see wrong is p(n)[COLOR="Red"]#[/COLOR] lol

never mind I fixed it embed the if and it worked for me lol.[/QUOTE]

.. Wait.. What revisions did you make to the code?

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

science_man_88 2010-11-28 00:05

[QUOTE=3.14159;238966].. Wait.. What revisions did you make to the code?

Also; Prime: 590 * (400! * p(400)#) + 1.[/QUOTE]

[CODE]cs(a,x,m)=for(n=a,x,print(m*fp(n)+1);if(isprime(m*fp(n)+1),break(1)))[/CODE]


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

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