Fast algorithm to obtain prime numbers and some pseudoprimes

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

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.