mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   gophne (https://www.mersenneforum.org/forumdisplay.php?f=149)
-   -   "New" primality test/check (https://www.mersenneforum.org/showthread.php?t=22838)

Batalov 2017-12-29 06:53

Subjectively, they can feel as if they are still alive for a long time.
Ambrose Bierce described that in 'An Occurrence at Owl Creek Bridge'.

gophne 2017-12-29 09:33

[QUOTE=ewmayer;475265]Yeah, we heard you the first million-and-six times. Try (n+2) = 2047 = 23*89 in your formula.[/QUOTE]
Hi ewmayer[B]

You are correct, that is a false positive (prime) result returned by the algorith. There are others as well. If you run the Code that I posted #73, you can identify many more. False positives are not uncommon with Primality algorithms, only the percentage of false positives w.r.t total number of "primes" tested

-Refer [B]Fermat Primality test[/B] which have "[B]......21853 pseudoprimes base 2 that are less than 2.5×10^10 (see page 1005 of [4]). This means that, for n up to 2.5×10^10, if 2n−1 (modulo n) equals 1, then n is prime, unless n is one of these 21853 pseudoprimes[/B]"......Source [url]https://en.wikipedia.org/wiki/Primality_test[/url]

Indications are that this algorithm will have less false positives at 2.5x10^10, currently sitting at +-750 at 10^7 and decreasing trend with increasing magnitude. Interestingly the smallest[I] false positive[/I] for the Fermat primality test is also the smallest [I]false positive[/I] for this algorithm!!! -[B]341[/B]

gophne 2017-12-29 09:52

[QUOTE=Batalov;475266]A person who walks off a 1km cliff also doesn't understand that he is already dead.
But he is.

This is exactly what is called a 2-PRP test. 1) It is >350 years old. 2) It is false.
Try n+2 == 341. (2^n-1) [B]mod[/B] (n+2) = (n+1)/2, then (n+2) is PRIME? Wrong. It is composite. [URL="https://en.wikipedia.org/wiki/Fermat%27s_little_theorem#Pseudoprimes"]F. Sarrus in 1820 found 341[/URL] as one of the first pseudoprimes, to base 2. That was 197 years ago.
Try n+2 == 561. (2^n-1) [B]mod[/B] (n+2) = (n+1)/2, then (n+2) is PRIME? Wrong. It is composite.
Try n+2 == 645. (2^n-1) [B]mod[/B] (n+2) = (n+1)/2, then (n+2) is PRIME? Wrong. It is composite.[/QUOTE]
Hi Batalov

Fermat Primality Test has [B]21,853 pseudo-primes in 2.5x10^10[/B]....refer my [I]post #79[/I] for reference for this figure. Do you consider the Fermat Primality Test [I]fake[/I] as well based on your reasoning/reference?

You refer to 3 examples, I have listed ([I]and have provided Code[/I]) for [B]245[/B] false primes up to [B]1,000,000[/B] (magnitude)

Batalov 2017-12-29 15:56

There is no reason for this self-flagellation to go on.
Please meditate in silence. [SPOILER]Or ask for your own logorrhea thread.[/SPOILER]

The thread is locked.

ewmayer 2017-12-29 23:17

Briefly reopening the thread for the benefit of our less-mathematical readers who may not see why the test in question is simply a base-2 Fermat pseudoprime test in disguise - start with the OP's version:

(2^n-1) == (n+1)/2 mod (n+2)

Replace the silly 'n+2' modulus by n, i.e. everywhere in the formula subtract 2 from n:

2^(n-2) - 1 == (n-1)/2 (mod n)

Multiply by 2:

2^(n-1) - 2 == (n-1) (mod n) == -1 (mod n)

Add 2 to both sides:

2^(n-1) == 1 (mod n) . QED

gophne 2017-12-30 18:36

[QUOTE=ewmayer;475324]Briefly reopening the thread for the benefit of our less-mathematical readers who may not see why the test in question is simply a base-2 Fermat pseudoprime test in disguise - start with the OP's version:

(2^n-1) == (n+1)/2 mod (n+2)

Replace the silly 'n+2' modulus by n, i.e. everywhere in the formula subtract 2 from n:

2^(n-2) - 1 == (n-1)/2 (mod n)

Multiply by 2:

2^(n-1) - 2 == (n-1) (mod n) == -1 (mod n)

Add 2 to both sides:

2^(n-1) == 1 (mod n) . QED[/QUOTE]
Hi ewmayer

Thanks for your post.

I don't understand why you say my algorithm is;

(2^n-1) == (n+1)/2 mod (n+2)

I thought it was

[B](2^n-1) mod (n+2) == (n+1)/2[/B]

Retracing your steps would then give

[1] Replacing (n+2) with n

2^(n-2)-1 mod n == (n-1)/2

[2] Multiplying by 2

2^(n-1)-2 mod n == (n-1)

[3] Add 2 to both sides

[B]2^(n-1) mod n == (n+1)[/B]

This is different from your result and therefore [I]not[/I] the algorith you reduced. Similar, but very different, like 1 is different from 2

Am I mistaken with this? If you would concur it would still mean my algorithm is original.

Batalov 2017-12-30 18:42

[QUOTE=gophne;475439]Am I mistaken with this? If you would concur it would still mean my algorithm is original.[/QUOTE]
You are.

Do you always read only the second explanation? First is not enough? It has to be repeated twice?
What Ernst wrote I already [URL="http://www.mersenneforum.org/showthread.php?p=475218#post475218"]spelled out for you two days ago[/URL].

danaj 2017-12-30 18:57

[QUOTE=gophne;475439]
I don't understand why you say my algorithm is;

(2^n-1) == (n+1)/2 mod (n+2)[/quote]

It's the usual way of writing a congruence equation. Both sides use modular arithmetic. You seem to be assuming only one.

[quote] [...]
[B]2^(n-1) mod n == (n+1)[/B][/quote]

If this is a congruence, then n+1 also has mod n applied, which means it is equivalent to 1, as they said. If you insist it is not, then how exactly could it *ever* be true? The lifted result of x mod n is always in the range 0 to n-1, so clearly it cannot be n+1.

gophne 2017-12-30 19:01

[QUOTE=Batalov;475440]You are.

Do you always read only the second explanation? First is not enough? It has to be repeated twice?
What Ernst wrote I already [URL="http://www.mersenneforum.org/showthread.php?p=475218#post475218"]spelled out for you two days ago[/URL].[/QUOTE]
Hi Batalov

I respect your opinions as an expert and a Mod. However I have a right to defend myself as well.

Please look at my reply to [I]ewmayer[/I] in post #83 and correct me where I am wrong/mistaken.

According to my humble understanding I do not think that the two are the same. Please explain how you can say the two algoriths are the same when ewmayer appears to have tweaked my algorithm, possibly unintentionally. Just juxtapose the two. They are [B]not[/B] the same -look at the formulas, not the same as what ewmayer reworked.

But thanks for taking me to task, but I will try to defend my position as I understand -sometimes ignorance is bliss.

I will also see how other users understand the issues, but for now I cannot agree that what ewmayer "re-worked" is the algorithm I posted.

Thanks

ATH 2017-12-30 19:49

[QUOTE=gophne;475439]I don't understand why you say my algorithm is;

(2^n-1) == (n+1)/2 mod (n+2)

I thought it was

[B](2^n-1) mod (n+2) == (n+1)/2[/B]
[/QUOTE]

The top line is just the usual way of writing modular equations, it means the same thing as you intend.


[QUOTE]
[B]2^(n-1) mod n == (n+1)[/B]

This is different from your result and therefore [I]not[/I] the algorith you reduced. Similar, but very different, like 1 is different from 2

Am I mistaken with this? If you would concur it would still mean my algorithm is original.[/QUOTE]


If something is equal to (n+1) mod n, then it is also equal to 1 mod n, and equal to 2n+1 mod n and 3n+1 mod n and so on.

If say n=5:

Then:
31 mod n = 1 because 31=6*n + 1
31 mod n = 6 = n+1 because 31= 5*n + 6
31 mod n = 11 = 2n+1 because 31 = 4*n + 11
and so on.

Batalov 2017-12-30 21:42

I wrote a ground-breaking new poem and I shall go around telling everyone that I've truly made something out of myself. Here is small bit of it. I have more, much more! --
[QUOTE]To be or not to be - that is the question:
If it is nobler in the mind to suffer
The slings and arrows of outrageous fortune
Or to take arms against a sea of troubles
And by opposing end them.[/QUOTE]Now some people keep telling me that some guy with a spear (never heard of him) already wrote something similar. But it is false. Mine is completely different. His version has some extra commas and the words are not the same; first of all, they are completely unnecessary, and secondly, surely this makes it not the same.


All times are UTC. The time now is 07:40.

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