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

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Wieferich primes step by step in the PicoLisp 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 PicoLisp programming language

Source code in the picolisp programming language

(de **Mod (X Y N)
   (let M 1
      (loop
         (when (bit? 1 Y)
            (setq M (% (* M X) N)) )
         (T (=0 (setq Y (>> 1 Y)))
            M )
         (setq X (% (* X X) N)) ) ) )
(let (D 2  L (1 2 2 . (4 2 4 2 4 6 2 6 .)))
   (until (> D 5000)
      (and
         (=1 (**Mod 2 (dec D) (* D D)))
         (println D) )
      (inc 'D (++ L)) ) )

  

You may also check:How to resolve the algorithm Greatest element of a list step by step in the Lua programming language
You may also check:How to resolve the algorithm ADFGVX cipher step by step in the J programming language
You may also check:How to resolve the algorithm Associative array/Creation step by step in the Common Lisp programming language
You may also check:How to resolve the algorithm Pascal's triangle step by step in the Tcl programming language
You may also check:How to resolve the algorithm Arithmetic/Integer step by step in the F# programming language