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)

CRGreathouse 2010-08-10 22:23

[QUOTE=3.14159;224817]I didn't ask for a list of bases?[/QUOTE]

You didn't ask in #147, the post I responded to when I posted that number.

I'm sorry if it bothers you that I'm not willing to put in the time to calculate what you want. Perhaps you can code a solution, or even hire someone to code it for you.

CRGreathouse 2010-08-10 22:25

[QUOTE=science_man_88;224818]might work CRG also i got this working as wanted:

[CODE]script(name) = print(name"()=");if(input()==all primes upto,print("is n greater than primelimit?"))[/CODE][/QUOTE]

OK. You should probably put "all primes upto" in quotes or something. Right now it works as you appear to intend it, but only insofar as it interprets the expression as the polynomial allprimesupto * 1 + 0, which is printed allprimesupto.

[QUOTE=science_man_88;224818]if I implement yours the hard part is telling how long the number(or it's representation) would be after this.[/QUOTE]

I don't fully understand but this seems like an easy part.

science_man_88 2010-08-10 22:27

[QUOTE=CRGreathouse;224823]OK. You should probably put "all primes upto" in quotes or something. Right now it works as you appear to intend it, but only insofar as it interprets the expression as the polynomial allprimesupto * 1 + 0, which is printed allprimesupto.



I don't fully understand but this seems like an easy part.[/QUOTE]

sorry edited too much.

science_man_88 2010-08-10 22:35

[CODE](19:32) gp > script(name) = print(name"()=");Vec(input());
(19:32) gp > script(foo)
foo()=
for me
%8 = [1, 0]
(19:33) gp > script(foo)
foo()=
fool you are a fool
*** input: Warning: unused characters: foolyouareafool.[/CODE]

3.14159 2010-08-10 22:40

[QUOTE=CRGreathouse]I'm sorry if it bothers you that I'm not willing to put in the time to calculate what you want. Perhaps you can code a solution, or even hire someone to code it for you.
[/QUOTE]

What I am merely asking for is some form of validation for the claim. Nothing more.

(Just post data, and I'll take your word for it afterwards.)

CRGreathouse 2010-08-10 22:41

You really want to take the second argument as a string argument rather than as input(); that would take care of your immediate issue. That issue, of course, is that it reads foolyouareafool and foo as polynomials not as strings.

science_man_88 2010-08-10 22:44

[QUOTE=CRGreathouse;224828]You really want to take the second argument as a string argument rather than as input(); that would take care of your immediate issue. That issue, of course, is that it reads foolyouareafool and foo as polynomials not as strings.[/QUOTE]

I want what makes this work so that you don't have to as hard.

how do I have them read as strings ?

CRGreathouse 2010-08-10 22:50

[QUOTE=science_man_88;224829]I want what makes this work so that you don't have to as hard.[/QUOTE]

If you made the program as I imagine it, you'd be up for a Knuth Prize at the least. :smile:


[QUOTE=science_man_88;224829]how do I check for a specific string in input() ? that's what I'm up against right now.[/QUOTE]

I would suggest something like
[code]script(name, text)={
print(name"()={");
if(text == "prime", print("isprime(47)"));
print("};");
print("addhelp("name", \""name": "text"\");")
};[/code]

which does
[code]> script("foobar", "prime")
foobar()={
isprime(47)
};
addhelp(foobar, "foobar: prime");

> script("foobar", "Lists the foobars up to N.")
foobar()={
};
addhelp(foobar, "foobar: Lists the foobars up to N.");[/code]

Of course you would replace "prime" with whatever it is you're looking for.

CRGreathouse 2010-08-10 22:52

[QUOTE=3.14159;224827]What I am merely asking for is some form of validation for the claim. Nothing more.

(Just post data, and I'll take your word for it afterwards.)[/QUOTE]

I linked to a program I wrote that gives the count of the bases to which a number is a strong pseudoprime, I used that program.

(I also wrote a modified version of it that I used for a modified version of the problem in which I generate random semiprimes rather than random odd numbers, but that's not what I used here because I wasn't sure if that would be what you consider a "general composite".)

science_man_88 2010-08-10 22:53

see I wanted it so people could write random functions without having to worry about what they input so I was thinking along Vec(input()) thanks to you then searching the vector for the specific phrase needed however this seems overly complicating.


so something like [CODE]Vec(input());forstep(i=1,length(input()),length(string to search for),if(v[i]=="a" && v[i+1]=="l"[/CODE] .etc then checking for the next space after that to find the end of the format of the number then pretty much you know the rest lol.

3.14159 2010-08-10 23:10

[QUOTE=CRGreathouse](I also wrote a modified version of it that I used for a modified version of the problem in which I generate random semiprimes rather than random odd numbers, but that's not what I used here because I wasn't sure if that would be what you consider a "general composite".)
[/QUOTE]

What I consider a general composite is any composite number, such as 35615990503459801, or 7948413665865367, or even 1208925819614629174706176.

[QUOTE=CRGreathouse]I linked to a program I wrote that gives the count of the bases to which a number is a strong pseudoprime, I used that program.
[/QUOTE]

So you waited until it generated 49 numbers?


All times are UTC. The time now is 06:55.

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