20061019, 22:17  #1 
Sep 2002
2·131 Posts 
another mersenne prime test
Here is another Mersenne prime test.
I don't know about the speed I only tested it in UBasic upto n=4423 it works fine. Code:
15 M=2 20 M=nxtprm(M) 30 N=2^M1 40 B=3 50 C=2 60 B=modpow(B,N\C,N) 70 C+=1 74 if C<4 then 60 75 if B=1 then print M;"is prime":goto 20 80 goto 20 
20061019, 23:52  #2 
Sep 2002
100000110_{2} Posts 
here is a revised one
Code:
15 M=2 20 M=nxtprm(M) 30 N=2^M1 40 N2=sft(N,1) 50 B=modpow(3,N2,N) 54 N3=sft(NN2,1) 55 B=modpow(B,N3,N) 75 if B=1 then print "2^";M;"1 is prime":goto 20 80 goto 20 Joss Last fiddled with by jocelynl on 20061019 at 23:58 
20061020, 00:03  #3 
∂^{2}ω=0
Sep 2002
República de California
11,743 Posts 
It would help if you posted in some kind of pseudocode that doesn't require knowledge of specific UBasic (or whatever) syntax. Anyway, had you bothered to actually *analyze* your algorithm, you'd see that it amounts to taking a Mersenne number N = M(p), then raising the seed B=3 to some "magic" obfuscated power which (using that \ is UBasic for "integer divide") equals
pow = floor(N/2) * floor(N/3). E.g. for M(p) with p=3 this works out to floor(7/2) * floor(7/3) = 3*2 = 6. For general odd p, it simply amounts to an obfuscated way or writing N1. Thus, this is nothing more than a base3 Fermat pseudoprime test. May I politely suggest you actually read up on your basic number theory? 
20061020, 00:44  #4 
Sep 2002
406_{8} Posts 
Sorry to have wasted your precious time.
this was my very last post to this forum and won't ever come back. JOSS 
20061020, 01:51  #5 
∂^{2}ω=0
Sep 2002
República de California
11,743 Posts 
If this were a firsttime post along these lines I would've been more patient, but in your case it's at least the 4th or 5th such thing. At some point you've gotta expect that other people will get tired at you basically asking them to do your homework for you. And yes, some of us *do* value our time, and get annoyed at having to to spend it debunking one bogus New! Improved!!! IDon'tKnowWhyItWorksButItSeemsReallyFastForExponentsBelow5000!!! thread after another.
Given the time you've spent around here and the fact that you clearly know enough about UBasic to even code such a test, there's simply no good excuse not to do a little bit of digging and ask yourself "hmm  I wonder why it works?" before starting a thread claiming to have found a new Mersenne primality test. 
20061020, 01:59  #6  
Jun 2003
The Texas Hill Country
3^{2}·11^{2} Posts 
Quote:
Your failure to return will be of no loss to most of us. [SOAPBOX] As for "wasting your precious time", your should take Dr. Mayer's suggestions and, in any forum,: (1) unless you are discussing the efficiency of code for an algorithm that has been established to be efficient, please avoid implementation details. Discuss proposed algorithms in "pseudocode" that is implementation independent and easier for everyone to understand. Most of us do not stay current on thirty or forty, or more, implentation languages that are still around. (I can still run IPLV. But I DARE you to understand those old programs :) ) (2) analyze the "complexity" of your proposed algorithm and be prepared to compare it to other established algorithms. In these circles, you need to make AN ATTEMPT to justify why your proposal has merit. If you think that it does, but cannot make the justification, it is quite permissible to show that you have made an effort to do so, isolate the "sticking points", and ask for assistance in resolving them. [/SOAPBOX] You might be surprised, but even "the worst ogre" here is actually helpful when he is approached appropriately. Lesser trolls are even more approachable. (For the record, ewmayer was polite in his response. Beware the ogre!) Richard PS: I am not "the worst ogre" mentioned above. 

20061020, 03:04  #7  
∂^{2}ω=0
Sep 2002
República de California
11,743 Posts 
Quote:
I'll leave it as a homework exercise for the interested (and nonindolent) reader to answer the following: a) Just how much slower is this (in an asymptotic largeN sense) than the Fermat PRP test? (Hint: it's slower, but not quadratically slower). b) Since this computes a power which is actually a multiple of N1, is this in fact an even weaker pseudoprime test than the Fermat pseudoprime test? 

20061020, 16:10  #8  
"Nancy"
Aug 2002
Alexandria
9A3_{16} Posts 
Quote:
Not like an orge or troll at all... halforc, tops. Alex Last fiddled with by akruppa on 20061020 at 19:36 Reason: not hobgoblin either 

20061020, 19:36  #9 
∂^{2}ω=0
Sep 2002
República de California
2DDF_{16} Posts 

Thread Tools  
Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
New test for Mersenne prime  allasc  Math  34  20220911 13:03 
(M48) NEW MERSENNE PRIME! LARGEST PRIME NUMBER DISCOVERED!  dabaichi  News  571  20201026 11:02 
Another way to PRP test Mersenne numbers  paulunderwood  Miscellaneous Math  18  20170126 20:33 
How do I test if it is a mersenne prime on GIMPS?  spkarra  Math  21  20150123 18:13 
The 40th known Mersenne prime, 2209960111 is not PRIME!  illmanq  Miscellaneous Math  33  20040919 05:02 