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)

kar_bon 2010-08-19 23:45

[QUOTE=3.14159;226307]You said I made several contradictory names for various prime forms, and you were therefore accusing me of being internally inconsistent. Please show where I am internally inconsistent.[/QUOTE]

So read again:

[QUOTE=CRGreathouse;226263]I can never keep track of all the names (especially since some are contradictory... e.g. several definitions for generalized Fermats). What form are these?[/QUOTE]

He never accused [b]you[/b]! It was meant generally!

3.14159 2010-08-20 01:09

Alright: My sieve only requires three arguments, as it is just Generalized proths. (Two for the kmin/kmax, one for the base and exponent)

Now it should be far easier to make all the appropriate substitutions and so on.

@CRG/sm88: Any hints on the appropriate substitutions, as the amount of arguments are the same?

Here is the [B]original[/B] code:


[code]sieve(lim, sz, sm=1)={
my(v=vectorsmall(sz,i,1));
forprime(p=3,p2,
b=znorder(Mod(2,p));
trap(,next,
a=znlog(2293,Mod(2,p))
);
if(Mod(2,p)^a!=2293, print("bad at "p);next);
a+=b*ceil((sm-a)/b);
forstep(n=a,sz,b,
v[n]=0
)
);
a=0;
for(i=sm,sz,if(v[i],a++;write("abc.txt", i)));
a
};[/code]

3.14159 2010-08-20 01:14

Make as many substitutions and modifications as you'd like. I'll try to make the appropriate substitutions/modifications to see if I can reach a finished product.

3.14159 2010-08-20 01:25

I thought of substituting the variables with the variables I designated, but this essentially does the same, and prints out the same factors, except it does so up to 10[sup]6[/sup].

Now it seems that substitutions didn't cut it. Any recommended modifications, anyone?

science_man_88 2010-08-20 12:24

one thing i find is you have a variable p2 declared as a maximum but no definition of it before hand that I know of.

3.14159 2010-08-20 12:44

[QUOTE=science_man_88]one thing i find is you have a variable p2 declared as a maximum but no definition of it before hand that I know of.
[/QUOTE]

Damn. I forgot to change that to "lim".

science_man_88 2010-08-20 12:48

since you use znlog() you can just check if a is a factorial because g^n=x n gets stored in a so if a=c! then the exponent to check is c! not a! so checking if a is a factorial means if true a!=c!! or a double factorial if such a thing exist anyway I'll shut up.

science_man_88 2010-08-20 13:02

you write i but unless you have a seperator you won't be able to figure out what's what in abc.txt I know I couldn't so adding "," to that call might be warranted if you want it to be understood.

science_man_88 2010-08-20 15:00

[CODE]a=0;y=Vec(input());for(x=1,3,for(i=1,#y,for(p=2,#try[x]-1,if(y[i+(p-1)]==try[x][p],a=a+1;print("really")));if(a==#try[x]-2)))[/CODE]

is my newest attempt at what I wanted to help CRG with. unfortunately this gives me errors.

science_man_88 2010-08-20 18:29

can setsearch be used on strings if it could we can use that as find and possibly replace if we can find a way to make sure the replacement can fit into it.

got it without errors but not working.

science_man_88 2010-08-20 18:47

I have other ideas about how to but I don't know enough on the routines.
I was also thinking vecextract.


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

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