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-29 19:17

[QUOTE=science_man_88;227540]what you want to calculate is:

[url]http://www.research.att.com/~njas/sequences/A070325[/url][/QUOTE]

Good catch. Related: [url]http://oeis.org/classic/A127435[/url]

science_man_88 2010-08-29 19:22

[CODE]for(n=1, 33000, if(isprime(n^2+1)*isprime(n^4+1)*isprime(n+1)==1, print1(n, ", ")))[/CODE]

that's the code that's up on [url]http://www.research.att.com/~njas/sequences/A070325[/url] but why multiply you still have to calculate isprime() to check it, is it faster than && ?

3.14159 2010-08-29 19:27

[QUOTE=CRGreathouse]A number x is in the set of squares and the set of fourth powers.

is the same as

A number x is in the the set of fourth powers.[/QUOTE]

This one falls apart really quickly.

This would only be true if the set of squares were all fourth powers as well.

25 is a square number and is not a 4th power.
625 is a square number and is a fourth power.

49 is a square number that is not in the set of fourth powers.
2401 is a square number that is in the set of fourth powers.

CRGreathouse 2010-08-29 19:29

Back on topic:
[QUOTE=3.14159;227519]Wait.. Prime fermat numbers are probably finite for any given base. So there are no examples for 120!. That explains it.

For item 16: There are probably [B]no 1000+ digit examples.[/B]

Due to that, this is the only category that will be restricted to small primes, 100-750 digits.

If you find me a 1000+ digit example, the restriction will be lifted.[/QUOTE]

With n = 3 · 2[SUP]410857[/SUP], n + 1, n[SUP]2[/SUP] + 1, and n[SUP]4[/SUP] + 1 are primes. Since 494724 ≥ 1000, I trust you'll be lifting the restriction?

3.14159 2010-08-29 19:31

[QUOTE=CRGreathouse]With n = 3 · 2[sup]410857[/sup], n + 1, n[sup]2[/sup] + 1, and n[sup]4[/sup] + 1 are primes. Since 494724 ≥ 1000, I trust you'll be lifting the restriction?
[/QUOTE]

Restriction lifted.

science_man_88 2010-08-29 19:31

[QUOTE=CRGreathouse;227542]Good catch. Related: [url]http://oeis.org/classic/A127435[/url][/QUOTE]

I could see if it was faster but according to a few test of each mine is about 40 times faster and I think I know why based on my knowledge of what the comparison in ASM might be like.

mine uses 2 cmp operations

the one shown uses 1 cmp and 3 mult() ? operations (not sure if this makes the difference though) as i don't know how much slower / faster multiplication is comparing it to a cmp() operation.

CRGreathouse 2010-08-29 19:32

[QUOTE=3.14159;227545][QUOTE=CRGreathouse;227539]A number x is in the [COLOR="Red"]set of squares[/COLOR] and the [COLOR="DarkGreen"]set of fourth powers[/COLOR].

is the same as

A number x is in the the [COLOR="DarkGreen"]set of fourth powers[/COLOR].[/QUOTE]

This one falls apart really quickly.[/QUOTE]

Really? Please provide an example of a member of the set of fourth powers that is not a member of the set of squares and the set of fourth powers, or a member of the set of squares and the set of fourth powers, but not a member of the set of fourth powers.

CRGreathouse 2010-08-29 19:35

[QUOTE=science_man_88;227549]I could see if it was faster[/QUOTE]

What is "it"?

[QUOTE=science_man_88;227549]mine uses 2 cmp operations

the one shown uses 1 cmp and 3 mult() ? operations (not sure if this makes the difference though) as i don't know how much slower / faster multiplication is comparing it to a cmp() operation.[/QUOTE]

imul takes about 4 times as long as cmp. fmul is similar. For older CPUs, cmp was relatively better.

3.14159 2010-08-29 19:37

[QUOTE=CRGreathouse]Really? Please provide an example of a member of the set of fourth powers that is not a member of the set of squares and the set of fourth powers, or a member of the set of squares and the set of fourth powers, but not a member of the set of fourth powers.
[/QUOTE]

There is no such example, but there is no redundancy.

Here's another example:

169 is a square number, and it is not a fourth power.
28561 is a square number, and it is also a fourth power.

Or:

169 is in set x but is not in set y.
28561 is in set x and is in set y.

All members of set y are in set x.
Not all members of set x are in set y.

science_man_88 2010-08-29 19:39

[QUOTE=CRGreathouse;227551]What is "it"?



imul takes about 4 times as long as cmp. fmul is similar. For older CPUs, cmp was relatively better.[/QUOTE]

that's why mine gave me times of 10-20 ms but the other gave me 600-650? ms

thanks I think if we want fast code in the OEIS the code shown should be changed for it= [url]http://www.research.att.com/~njas/sequences/A070325[/url]

CRGreathouse 2010-08-29 19:40

[QUOTE=3.14159;227553]There is no such example, but there is no redundancy.

Here's another example:

169 is a square number, and it is not a fourth power.
28561 is a square number, and it is also a fourth power.

Or:

169 is in set x but is not in set y.
28561 is in set x and is in set y.

No redundancies.[/QUOTE]

Ah, so you just don't understand the word "redundancy".


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

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