mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   Miscellaneous Math (https://www.mersenneforum.org/forumdisplay.php?f=56)
-   -   6(a^2+b^2)-1 is not a prime (https://www.mersenneforum.org/showthread.php?t=23026)

ariwnyj 2018-02-06 04:24

6(a^2+b^2)-1 is not a prime
 
Why is it that if you take a sum of two squares, s=a^2+b^2 you never get that 6 s-1 is a prime?

CRGreathouse 2018-02-06 05:29

[QUOTE=ariwnyj;479430]Why is it that if you take a sum of two squares, s=a^2+b^2 you never get that 6 s-1 is a prime?[/QUOTE]

6(1^2 + 1^2) - 1 = 11 which is prime. :confused:

axn 2018-02-06 06:21

a,b,s,6*s-1
[CODE]1 1 2 11
1 2 5 29
1 3 10 59
1 4 17 101
1 8 65 389
1 9 82 491
2 2 8 47
2 5 29 173
2 6 40 239
2 7 53 317
2 9 85 509
3 3 18 107
3 4 25 149
3 6 45 269
3 7 58 347
3 10 109 653
4 4 32 191
4 6 52 311
4 7 65 389
4 8 80 479
5 7 74 443
6 6 72 431
6 7 85 509
6 8 100 599
6 9 117 701
7 7 98 587
7 8 113 677
8 10 164 983
9 9 162 971[/CODE]

LaurV 2018-02-07 04:47

:davar55: ...

[CODE]gp > start=10^30; end=10^30+10; for(i=start,end,for(j=i+1,end,s=(i^2+j^2); if(isprime(t=6*s-1),print([i,j,s,t]))))
[1000000000000000000000000000002, 1000000000000000000000000000006, 2000000000000000000000000000016000000000000000000000000000040, 12000000000000000000000000000096000000000000000000000000000239]
[1000000000000000000000000000002, 1000000000000000000000000000007, 2000000000000000000000000000018000000000000000000000000000053, 12000000000000000000000000000108000000000000000000000000000317][/CODE]Actually these primes seem quite dense, and a better puzzle should be to find the largest interval [start,end] with no primes...
edit: for whatever reason I assumed in the piece of code above that i and j must be different, but that won't change the result much... :redface:

axn 2018-02-07 06:46

[QUOTE=LaurV;479495]Actually these primes seem quite dense, and a better puzzle should be to find the largest interval [start,end] with no primes...[/QUOTE]

7023529-7023545 (length 17)
15209599-15209616 (length 18)

axn 2018-02-07 07:43

[QUOTE=axn;479500]7023529-7023545 (length 17)
15209599-15209616 (length 18)[/QUOTE]

40097513-40097531 (19)

LaurV 2018-02-07 07:59

That was more like a joke, but I will pick the glove. Your intervals are right, but the lengths are wrong. I added the next one, 18, just to be correct, and to add something to it.

[CODE]
gp > n=1; s=1; t=s+n; while(1, b=0; for(i=s,t,for(j=i,t,if(isprime(6*(i^2+j^2)-1),b=1;s=i+1;t=s+n;break(2)))); if(b==0,print([n,s,t]);t++;n++))
[1, 18, 19]
[2, 51, 53]
[3, 51, 54]
[4, 228, 232]
[5, 810, 815]
[6, 810, 816]
[7, 3749, 3756]
[8, 5814, 5822]
[9, 17107, 17116]
[10, 28540, 28550]
[11, 110645, 110656]
[12, 344629, 344641]
[13, 344629, 344642]
[14, 2352809, 2352823]
[15, 2469300, 2469315]
[16, 7023529, 7023545]
[17, 15209599, 15209616]
[18, 40097513, 40097531]
[/CODE]

Edit: crosspost (did not refresh before posting, sorry)

axn 2018-02-07 08:02

[QUOTE=axn;479502]40097513-40097531 (19)[/QUOTE]

97774240-97774262 (23)

I am counting the numbers in the interval including the starting and ending point

paulunderwood 2018-02-07 08:13

[QUOTE=LaurV;479503]That was more like a joke, but I will pick the glove. Your intervals are right, but the lengths are wrong. I added the next one, 18, just to be correct, and to add something to it.

[CODE]
gp > n=1; s=1; t=s+n; while(1, b=0; for(i=s,t,for(j=i,t,if(isprime(6*(i^2+j^2)-1),b=1;s=i+1;t=s+n;break(2)))); if(b==0,print([n,s,t]);t++;n++))
[1, 18, 19]
[2, 51, 53]
[3, 51, 54]
[4, 228, 232]
[5, 810, 815]
[6, 810, 816]
[7, 3749, 3756]
[8, 5814, 5822]
[9, 17107, 17116]
[10, 28540, 28550]
[11, 110645, 110656]
[12, 344629, 344641]
[13, 344629, 344642]
[14, 2352809, 2352823]
[15, 2469300, 2469315]
[16, 7023529, 7023545]
[17, 15209599, 15209616]
[18, 40097513, 40097531]
[/CODE]

Edit: crosspost (did not refresh before posting, sorry)[/QUOTE]

[c]ispseudoprime()[/c] maybe faster than [c]isprime()[/c] and is good for at least 2^64

LaurV 2018-02-07 08:15

Oh.. maybe you are right, that should be the right way to count, as there are no primes there...

23? is that pari? Or you use something faster? Or a better algoritm that does not need to test n^2/2 numbers? I don't seem to have a chance with pari, getting to 18 (19 in your counting) took a bit over 20 minutes, I stopped it.

LaurV 2018-02-07 08:18

[QUOTE=paulunderwood;479505][c]ispseudoprime()[/c] maybe faster than [c]isprime()[/c] and is good for at least 2^64[/QUOTE]
It is not, I tried it many times, when you test small numbers (without pre-sieve), it always does exponentiation, even Mod(2,x)^(x-1)==1 is slower (checking if they are 2-PRP, instead of isprime()) when you test a lot of small numbers, because isprime() does a bit of trial division too, and for the most of the numbers it will return much faster. If you have a lot of numbers that do not have small factors, then of course, both other methods are faster than isprime().


All times are UTC. The time now is 14:53.

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