Message Boards Message Boards

0
|
5790 Views
|
1 Reply
|
0 Total Likes
View groups...
Share
Share this post:

Fast algorithm to obtain prime numbers and some pseudoprimes

Posted 4 years ago

Hello All:

I have obtained a fast algorithm to obtain prime numbers and some pseudoprimes:

G[n_, i_] := PowerMod[i, n+ i, n + i]

n = 10^100

While[n < 10^100 + 100000, i = 2; While[Abs[G[n, i] - i] > 0, i++]; 
  Print[n + i, " ", PrimeQ[n + i]]; n = n + i]

Can you analyze it?

Sincerely

Sebastián Martin Ruiz

Posted 4 years ago

Hello Sebastián Martin Ruiz-san

This is a very interesting program.

It's great that it's a short program, fast and easy to handle large numbers.

I still don't understand the structure of this program. There are also functions that I haven't used yet. I will study using this as a teaching material.

POSTED BY: Koichi Ohno
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract