View Single Post
Old 2006-10-20, 00:03   #3
ewmayer's Avatar
Sep 2002
Rep├║blica de California

1158110 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 N-1. Thus, this is nothing more than a base-3 Fermat pseudoprime test.

May I politely suggest you actually read up on your basic number theory?
ewmayer is offline   Reply With Quote