mersenneforum.org  

Go Back   mersenneforum.org > Extra Stuff > Miscellaneous Math

Reply
 
Thread Tools
Old 2018-08-30, 04:30   #1
mikenickaloff
 
Aug 2018

2 Posts
Talking Algorithm for finding arbitrary length prime numbers

Here's a way to check any number of any size and determine if its prime or not..
This solution was created by creating a visual representation of all prime numbers in a torus shape and then using the patterns to create an algorithm.

It works 100% of the time and is extremely fast.

Would like my prize money now. :)

I have tested it up to on numbers up to 16,000 digits.

just throw this into any old web page and then call it by using

isHugePrime("38538578375837958593379379573975937593839839393...")

from the javascript console or from a button or whatever..


You could also use put this into node.js as long as it is a recent version that supports BigInteger()

Its possible that not all browsers will support BigInteger, but the latest version of google chrome does.




function isHugePrime(inp_x) {
var x = BigInt(inp_x);
var square_nums = [9n, 25n, 49n, 77n, 1n, 35n, 55n];
var prime_nums = [3n, 5n, 7n, 11n, 13n, 17n, 19n, 23n, 29n, 31n, 37n, 41n, 43n, 47n, 53n, 59n, 61n, 67n, 71n, 73n];

var y = BigInt(x % 78n);
if (prime_nums.includes(x)) { return true; }
if ((prime_nums.includes(y)) || (y == BigInt(1)) || (square_nums.includes(y))) {
if ((x % 5n) !== 0n) {
if ((x % 3n) !== 0n) {
if ((x % 7n) !== 0n) {
if ((x % 11n) !== 0n) {
if ((y !== 1n) && ((x % y) !== 0n)) {
// number is prime
var q = x;

if ((2n > q) && (q > 0n)) { return true; }
q = x;
for (var t=0; t<prime_nums.length; t++) {
var r = prime_nums[t];
if ((q % r) === 0n) { return false; }
}

return true;
}
if (y === 1n) {
var q = x;
for (var t=0; t<prime_nums.length; t++) {
var r = prime_nums[t];
if ((q % r) === 0n) { return false; }
}
return true;
}

}
}
}
}
}
return false;
}

----------------------------
To find the next largest known prime number use this:

var b = BigInt(2);
for (var a=BigInt0); a<BigInt(23249425); a++) {
b *= BigInt(2);
}
b -= BigInt(1);
while (!isHugePrime(b)) {
b += BigInt(2);
}

console.log("New largest Prime Number is: " + b);

----------------------------

You're welcome.

See a working implementation here:

https://www.datafault.net/prime-numb...ery-algorithm/

- Mike Nickaloff
mikenickaloff is offline   Reply With Quote
Old 2018-08-30, 06:04   #2
Uncwilly
6809 > 6502
 
Uncwilly's Avatar
 
"""""""""""""""""""
Aug 2003
101×103 Posts

23×1,223 Posts
Default

Your on line implementation says:
Code:
7696568587567657865765666555433211000909999900099009887766555555555555511111111111111111111111111111111111111111111111111111111111112222222223333333333333333
is prime.
Yet it has the following divisors
Code:
673 × 112327 × 116595455507 × 748525833482681 × 
1166566505322312486193150257928112755162713109167952205730414582722132849385466474765943381598469505978684195897584951990969
Ooops.

Edit, here is another failure:
Code:
1040793219466439908192524032736408553861526224726670480531911235040360805967336029801223944173232418484242161395428100779138356624832346490813990660567732076292412950938922034577318334966158355047295942054768981121169367714754847886696250138443826029173234888531116082853841658502825560466622483189091880184706822220314052102669843548873295802887805086973618690071472071055570316872907
Your code says it is prime.
But it has factors:
Code:
283277 x 
456244061762219521864117160570029132489322850724855993057919251789927516720867738650591281131737139977864230957359440731
068870472137543799825266131972221418825199467436026495008287419224660377 x
805296691510817189295490210235968914683018477894174241216052224130316821910828868299564174168282529075541309314486246202
6018181358485577717662678790939988400491382417845898096355994648783

Last fiddled with by Uncwilly on 2018-08-30 at 06:13
Uncwilly is online now   Reply With Quote
Old 2018-08-30, 18:11   #3
Uncwilly
6809 > 6502
 
Uncwilly's Avatar
 
"""""""""""""""""""
Aug 2003
101×103 Posts

978410 Posts
Default

Further:
Your on-line implementation fails to run properly (as in not at all) in
Chrome Version 68.0.3440.106 (Official Build) (64-bit)
and
IE 11.0

At least when I pasted in 200+ digit numbers.

I was going to try to test it with known large primes, but it just fails to run.



Edit:
adding another failure:
Code:
3365210933584511111333333777777777777777777777777777777777777777777777777777777777777777777777777777777777777774532109871
You say is prime. But has factors as follows:
Code:
138763 ×
4032951243694610539 ×
9863328490764362267243 ×
2621083985769163875931519 ×
232600800415619348680869697959771057081219722073259

Last fiddled with by Uncwilly on 2018-08-30 at 22:46
Uncwilly is online now   Reply With Quote
Old 2018-08-30, 18:12   #4
BudgieJane
 
BudgieJane's Avatar
 
"Jane Sullivan"
Jan 2011
Beckenham, UK

4048 Posts
Default

I decided to try the "huge" number 10403 obtained by multiplying the primes 101 and 103. Your web page tells me that this is prime.

It also tells me that 1 is prime (it isn't) and that 2 is not prime (it is).

Back to the drawing board, methinks.
BudgieJane is offline   Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Is this viable to fast finding prime numbers? PandaLz Computer Science & Computational Number Theory 14 2018-06-22 21:34
Endorsement Prime Numbers finding algorithm marouane Computer Science & Computational Number Theory 18 2017-11-06 15:41
This simple algorithm incomplete can only calculate prime numbers? Ale Miscellaneous Math 38 2015-11-29 23:27
New method of finding large prime numbers georgelouis@mac Math 41 2011-01-25 21:06
New Prime-Finding Algorithm Discovered! L00K HERE! dilip_1bhowmik Miscellaneous Math 22 2009-01-09 23:39

All times are UTC. The time now is 18:16.


Fri Jul 16 18:16:46 UTC 2021 up 49 days, 16:04, 1 user, load averages: 2.23, 2.35, 2.04

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

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.