mersenneforum.org  

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

Reply
 
Thread Tools
Old 2010-08-17, 18:18   #628
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

3×1,993 Posts
Default

Your statements are , likewise, unclear to me. (Why are you trying to make em2 a vector?!?) But I know that it can be done since I do this all the time.
CRGreathouse is offline   Reply With Quote
Old 2010-08-17, 18:18   #629
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

24×3×5×7 Posts
Default

Vectors are inefficient and unnecessary here. em2 and mem were decent advances. em2 and mem were, as I see it, the most progress I ever made.

Last fiddled with by 3.14159 on 2010-08-17 at 18:20
3.14159 is offline   Reply With Quote
Old 2010-08-17, 18:22   #630
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

24·3·5·7 Posts
Default

Quote:
Originally Posted by CRGreathouse
Your statements are , likewise, unclear to me. (Why are you trying to make em2 a vector?!?) But I know that it can be done since I do this all the time.
Nevermind that. I'm going to go in the direction I was going in using em2 and mem.

mem needs some fixing in order to avoid the loop repeat: em2 is 100% functional.

Last fiddled with by 3.14159 on 2010-08-17 at 18:22
3.14159 is offline   Reply With Quote
Old 2010-08-17, 18:30   #631
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

3×1,993 Posts
Default

Well, post your functions and maybe we can compare.
CRGreathouse is offline   Reply With Quote
Old 2010-08-17, 18:34   #632
kar_bon
 
kar_bon's Avatar
 
Mar 2006
Germany

22×727 Posts
Default

Not so hard to understand:

You searching for say k*360! + 1,

so set
v[1]=1 (k=1)
v[2]=2 (k=2)
v[3]=3 (k=3)
...
v[n]=n (k=n)

for all k-values you want to search for.

If you find a primefactor of say 123*360!+1, set v[123]=0.

Do this for all primefactors you will test: set the vector[index]=0.

After you've sieved all primefactors, the vector v contains some/many values set to 0, so these indices have a small factor and you do not need to test them.

You can "print" all indices n, where v[n] != 0, -> no primefactor found after sieving -> list of all k-values to test!
kar_bon is offline   Reply With Quote
Old 2010-08-17, 18:43   #633
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

3·1,993 Posts
Default

Yes. Though I would set them all to 1 rather than to their own values -- you know that from their location. Of course ideally you'd use just one bit per number rather than a whole word, but for convenience in Pari I usually don't bother.
CRGreathouse is offline   Reply With Quote
Old 2010-08-17, 18:49   #634
kar_bon
 
kar_bon's Avatar
 
Mar 2006
Germany

B5C16 Posts
Default

Quote:
Originally Posted by CRGreathouse View Post
Yes. Though I would set them all to 1 rather than to their own values -- you know that from their location. Of course ideally you'd use just one bit per number rather than a whole word, but for convenience in Pari I usually don't bother.
Yes, that's only necessary but to show the relation of factor and index...

And further:

There's no need to divide every candidate by that small factor:

Find the first occurence and the step-width (like in the example from yesterday) and it's a simple for-loop to strike out all candidates with that small factor!
kar_bon is offline   Reply With Quote
Old 2010-08-17, 18:50   #635
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

24×3×5×7 Posts
Default

Quote:
Originally Posted by Karsten
v[1]=1 (k=1)
v[2]=2 (k=2)
v[3]=3 (k=3)
...
v[n]=n (k=n)
v[n] returns : "not a vector", for any n used.

Quote:
Originally Posted by Charles
Well, post your functions and maybe we can compare.
Look at the code snippets I posted earlier on.

Last fiddled with by 3.14159 on 2010-08-17 at 18:52
3.14159 is offline   Reply With Quote
Old 2010-08-17, 18:54   #636
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

24·3·5·7 Posts
Default

Quote:
Originally Posted by Karsten
Find the first occurence and the step-width (like in the example from yesterday) and it's a simple for-loop to strike out all candidates with that small factor!
Fair enough.

Interesting coincidence: 353, 360, and 367 are all 7 units apart.

353 * 360! + 1 is divisible by 367.

Last fiddled with by 3.14159 on 2010-08-17 at 18:56
3.14159 is offline   Reply With Quote
Old 2010-08-17, 19:06   #637
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

3·1,993 Posts
Default

Quote:
Originally Posted by 3.14159 View Post
v[n] returns : "not a vector", for any n used.
Yeah, I told you half a dozen times how to handle that, including a commentary of the effectiveness of different versions.

Code:
v=vector(number_of_k_values_to_test)
Quote:
Originally Posted by 3.14159 View Post
Look at the code snippets I posted earlier on.
I have twice asked for the omitted portion, without which I cannot duplicate or even follow your code.

Last fiddled with by CRGreathouse on 2010-08-17 at 19:08
CRGreathouse is offline   Reply With Quote
Old 2010-08-17, 19:09   #638
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

24·3·5·7 Posts
Default

Quote:
Originally Posted by CRGreathouse
I have twice asked for the omitted portion, without which I cannot duplicate or even follow your code.
What omitted portion? em2 and mem have nothing missing!

If you're referring to em2:

em2(x,n,a)=forstep(b=lift(Mod(-1,x)/n),10^a,x, print(b))

Quote:
Originally Posted by CRGreathouse
Yeah, I only told you half a dozen times how to handle that, including a commentary of the effectiveness of different versions.
6? O rly?

Last fiddled with by 3.14159 on 2010-08-17 at 19:14
3.14159 is offline   Reply With Quote
Reply

Thread Tools


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:05.


Fri Aug 6 23:05:08 UTC 2021 up 14 days, 17:34, 1 user, load averages: 3.39, 3.74, 3.87

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.