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-11 13:52

You used 2701, which was a bad case. Here are some other bad bases and their ratios:

[code]A141768=[9, 25, 49, 91, 341, 481, 703, 1541, 1891, 2701, 5461, 6533, 8911, 12403, 18721, 29341, 31621, 38503, 79003, 88831, 146611, 188191, 218791, 269011, 286903, 385003, 497503, 597871, 736291, 765703, 954271, 1024651, 1056331, 1152271, 1314631];
for(i=1,#A141768,print(ratio(A141768[i])"\t"A141768[i]))[/code]
gives something like
[code]0.750000000 9
0.833333333 25
0.875000000 49
0.800000000 91
0.852941176 341
0.887500000 481
0.769230769 703
0.842857143 1541
0.761904762 1891
0.820000000 [COLOR="Red"]2701[/COLOR]
0.838461538 5461
0.838028169 6533
0.800000000 8911
0.754716981 12403
0.835576923 18721
0.861963190 29341
0.835483871 31621
0.752688172 38503
0.751879699 79003
0.751773049 88831
0.751381215 146611
0.751219512 188191
0.751131221 218791
0.751020408 269011
0.750988142 286903
0.750853242 385003
0.750750750 497503
0.750684931 597871
0.750617283 736291
0.750605326 765703
0.750542299 954271
0.765217391 1024651
0.750515464 1056331
0.758884636 1152271
0.750462107 1314631[/code]

For more, see the b-file.

CRGreathouse 2010-08-11 13:53

[QUOTE=3.14159;224901]Ah, thanks. Although, I do have it perform trial division for isSPRP, up to 10[sup]6[/sup]. isPRP does not perform trial division.[/QUOTE]

I'm not sure what trial division gets you here.

[QUOTE=3.14159;224901]Also: Define star(n) (I haven't defined it already.)[/QUOTE]

I edited it in before you posted this. :smile: Sorry, I had it in the sequence but initially forgot to include it here.

3.14159 2010-08-11 13:58

[QUOTE=CRGreathouse]I edited it in before you posted this. Sorry, I had it in the sequence but initially forgot to include it here.
[/QUOTE]

I looked in the sequence and found it. Now, the code works just fine.

I made a base counter as well:

[code]bcount(n) = {
n = n * (1-(ratio(n)))
}[/code]

Corrections: 1-(ratio(n)) needs another set of parentheses. Corrections made.

CRGreathouse 2010-08-11 14:01

[QUOTE=3.14159;224904]I made a base counter as well:[/QUOTE]

That's already in the sequence! I just modified it to give the ratio, since that's what you cared about. Use *that* program, not the one you posted, since rounding errors will be important here.

3.14159 2010-08-11 14:02

Testing for primes: Expected result, every base registers prime.

[QUOTE=CRGreathouse]That's already in the sequence! I just modified it to give the ratio, since that's what you cared about. Use *that* program, not the one you posted, since rounding errors will be important here.
[/QUOTE]

Nope, it just gives how often it will be marked off as composite.

The base counter naturally followed. Rounding errors? Why did you make a program that was inaccurate? :lol:!

CRGreathouse 2010-08-11 14:09

[QUOTE=3.14159;224906]The base counter naturally followed. Rounding errors? Why did you make a program that was inaccurate? :lol:![/QUOTE]

I made it output the result in floating-point because you gave the result as 0.82 rather than 41/50. It would be easy to modify the program to give an exact rational -- but why compute the sum, convert to a ratio, then convert back?


I don't understand what you mean by
[QUOTE=3.14159;224906]Nope, it just gives how often it will be marked off as composite.[/QUOTE]
or if I'm supposed to respond to it.

science_man_88 2010-08-11 14:09

[QUOTE=3.14159;224906]Why did you make a program that was inaccurate? :lol:![/QUOTE]

I'm sure people could ask you that same question :lol:

3.14159 2010-08-11 14:11

[QUOTE=CRGreathouse]I made it output the result in floating-point because you gave the result as 0.82 rather than 41/50. It would be easy to modify the program to give an exact rational -- but why compute the sum, convert to a ratio, then convert back?
[/QUOTE]

Seeing as it works just fine for small numbers (I would rarely need it for large integers), it works for me!

[QUOTE=CRGreathouse]I don't understand what you mean by...or if I'm supposed to respond to it.[/QUOTE]

Nevermind that..

[QUOTE=science_man_88]I'm sure people could ask you that same question :lol:[/QUOTE]

And this statement, coming from one who can't properly define his own terminology, 97% of the time? Right, and the moon is made of cheese. :missingteeth:

CRGreathouse 2010-08-11 14:12

[QUOTE=science_man_88;224908]I'm sure people could ask you that same question :lol:[/QUOTE]

True enough. My program gave the floating-point number closest to the exact quantity, but Pi's program suffers from [url=http://docs.sun.com/app/docs/doc/800-7895/6hos0aou8?a=view]catastrophic cancellation[/url] that may give wildly inaccurate results for large enough numbers and small enough precision. (They don't have to be that large or that low, even!)

CRGreathouse 2010-08-11 14:14

[QUOTE=3.14159;224909]Prime powers always have n-1 bases hat register it as pseudoprime. :tu:[/QUOTE]

You can see that just from examining the program: it looks only at the [url=http://oeis.org/classic/A007947]radical[/url] of the number.

science_man_88 2010-08-11 14:20

so the basic idea I have of the process required is:

1)read for updates
2)send request to next part of script
3)find function names that can be understood in the text (if none exist give error and/or print questions the script has about the request)
4)print out code for functions if they are found to be in the database.
5) post code to Mersenne forums website.


All times are UTC. The time now is 21:15.

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