How to resolve the algorithm Wieferich primes step by step in the Wren programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Wieferich primes step by step in the Wren programming language

Table of Contents

Problem Statement

In number theory, a Wieferich prime is a prime number p such that p2 evenly divides 2(p − 1) − 1 .

It is conjectured that there are infinitely many Wieferich primes, but as of March 2021,only two have been identified.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Wieferich primes step by step in the Wren programming language

Source code in the wren programming language

import "/math" for Int
import "/big" for BigInt

var primes = Int.primeSieve(5000)
System.print("Wieferich primes < 5000:")
for (p in primes) {
    var num = (BigInt.one << (p - 1)) - 1
    var den = p * p
    if (num % den == 0) System.print(p)
}

  

You may also check:How to resolve the algorithm Long year step by step in the BASIC programming language
You may also check:How to resolve the algorithm Call a function step by step in the Ol programming language
You may also check:How to resolve the algorithm Generic swap step by step in the Logo programming language
You may also check:How to resolve the algorithm Arena storage pool step by step in the Delphi programming language
You may also check:How to resolve the algorithm Empty program step by step in the M2000 Interpreter programming language