mersenneforum.org  

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

Reply
 
Thread Tools
Old 2010-08-23, 22:34   #793
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

32208 Posts
Default

Quote:
Originally Posted by science_man_88
best i could do i know it prints a lot I messed something up but it what I could do.
You asked it for for every candidate that is not divisible by a certain prime. It is repeating the loop over and over for every prime.
3.14159 is offline   Reply With Quote
Old 2010-08-23, 22:42   #794
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

20C016 Posts
Default

Quote:
Originally Posted by science_man_88 View Post
Code:
sievex(kmin,kmax,b,n,pmax)= for(k=kmin,kmax,forprime(p=1,pmax,if((k*b!^n+1)%p==0,,print("no factor found under "pmax" for "k"*"b"!^"n"+1"))))
best i could do i know it prints a lot I messed something up but it what I could do.
Code:
sievex(kmin,kmax,b,n,pmax)= for(k=kmin,kmax,forprime(p=1,pmax,if((k*b!^n+1)%p==0 && (k*b!^n+1)!=p,print("found factor " p " for "k"*"b"!^"n"+1"))))
give it a wild limit and it prints a lot.

I think I could improve it one more way. should i try to help it more ?

Last fiddled with by science_man_88 on 2010-08-23 at 22:43
science_man_88 is offline   Reply With Quote
Old 2010-08-23, 22:50   #795
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

24·3·5·7 Posts
Default

Quote:
Originally Posted by science_man_88
I think I could improve it one more way. should i try to help it more ?
Do what you can.
3.14159 is offline   Reply With Quote
Old 2010-08-23, 22:56   #796
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26·131 Posts
Default

would you rather it spit out when it found a factor or when it hasn't(less printing I think).
science_man_88 is offline   Reply With Quote
Old 2010-08-23, 23:04   #797
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26·131 Posts
Default

one thing to stop limitation (though going far enough with pmax it may slow down)
a code to check if it's above primelimit if not use the code already made if not use another code. so basically

Code:
if(pmax>default(primelimit),code1,code2)
code one could increase primelimit and if it can't go high enough switch to code 2 maybe. might be harder to code.
science_man_88 is offline   Reply With Quote
Old 2010-08-23, 23:35   #798
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26×131 Posts
Default

Code:
sievex(kmin,kmax,b,n,pmax)={a=0;for(k=kmin,kmax,forprime(p=1,pmax,if((k*b!^n+1)%p==0 && (k*b!^n+1)!=p,a=a+1)));if(a==0,print("no factor found for "k"*"b"!^"n"+1 in this range");a=0)}
can't get this to work like I wanted.
science_man_88 is offline   Reply With Quote
Old 2010-08-23, 23:46   #799
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

24·3·5·7 Posts
Default

Quote:
Originally Posted by science_man_88
can't get this to work like I wanted.
What seems to be the error?
3.14159 is offline   Reply With Quote
Old 2010-08-23, 23:46   #800
kar_bon
 
kar_bon's Avatar
 
Mar 2006
Germany

1011010111002 Posts
Default

Quote:
Originally Posted by 3.14159 View Post
Here's an example for k * 19!6 + 1:
Code:
k=1: factor is 241
k=1: factor is 579637
k=1: factor is 710341
k=2: factor is 31249
k=3: factor is 67
k=4: factor is 169937
k=5: factor is 47
k=7: factor is 20269
k=7: factor is 489449
k=9: factor is 43
k=9: factor is 643
k=9: factor is 3907
k=9: factor is 2897
I've inserted the k-value where the factors come from as example and verification (see here for more factorizations. The first PRP is for k=150!).
kar_bon is offline   Reply With Quote
Old 2010-08-23, 23:56   #801
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

24×3×5×7 Posts
Default

Quote:
Originally Posted by kar_bon
I've inserted the k-value where the factors come from as example and verification (see here for more factorizations. The first PRP is for k=150!).
The first PRP =
Code:
57133839564458545904789328652610540031895535786011264182548375833179829124845398393126574488675311145377107878746854204162666250198684504466355949195922066574942592095735778929325357290444962472405416790722118445437122269675520000000000000000000000000000000000000 * 19!6 + 1
? O rly?

Last fiddled with by 3.14159 on 2010-08-23 at 23:56
3.14159 is offline   Reply With Quote
Old 2010-08-23, 23:57   #802
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26·131 Posts
Default

your guess is as good as mine there Pi:

Code:
(20:53) gp > sievex(1,10,6,1,500000)
found factor 7 for 1*6!^1+1
found factor 103 for 1*6!^1+1
found factor 11 for 2*6!^1+1
found factor 131 for 2*6!^1+1
found factor 43 for 4*6!^1+1
found factor 67 for 4*6!^1+1
found factor 13 for 5*6!^1+1
found factor 277 for 5*6!^1+1
found factor 29 for 6*6!^1+1
found factor 149 for 6*6!^1+1
found factor 71 for 7*6!^1+1
found factor 7 for 8*6!^1+1
found factor 823 for 8*6!^1+1
found factor 19 for 10*6!^1+1
found factor 379 for 10*6!^1+1
time = 281 ms.
<)%p==0 && (k*b!^n+1)!=p,a=a+1)));if
time = 0 ms.
%270 = (kmin,kmax,b,n,pmax)->a=0;for
(20:54) gp > sievex(1,10,6,1,500000)
first sieve gives the result shown first the second sieve should show no factor for 3*6!^1+1 as it only prints if it finds no factor but it hasn't printed anything. both test had the same sievex() values

Last fiddled with by science_man_88 on 2010-08-23 at 23:58
science_man_88 is offline   Reply With Quote
Old 2010-08-24, 00:09   #803
kar_bon
 
kar_bon's Avatar
 
Mar 2006
Germany

1011010111002 Posts
Default

Quote:
Originally Posted by 3.14159 View Post
The first PRP =
Code:
57133839564458545904789328652610540031895535786011264182548375833179829124845398393126574488675311145377107878746854204162666250198684504466355949195922066574942592095735778929325357290444962472405416790722118445437122269675520000000000000000000000000000000000000 * 19!6 + 1
? O rly?
The '!' was not the factorial-sign!
kar_bon 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:07.


Fri Aug 6 23:07:28 UTC 2021 up 14 days, 17:36, 1 user, load averages: 3.82, 3.85, 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.